// AddActionPruneSettings adds the model settings
// to control log pruning if they are missing.
187282
func AddActionPruneSettings(pool *StatePool) error {
	st := pool.SystemState()
	err := applyToAllModelSettings(st, func(doc *settingsDoc) (bool, error) {
		settingsChanged :=
			maybeUpdateSettings(doc.Settings, config.MaxActionResultsAge, config.DefaultActionResultsAge)
		settingsChanged =
			maybeUpdateSettings(doc.Settings, config.MaxActionResultsSize, config.DefaultActionResultsSize) || settingsChanged
		return settingsChanged, nil
	})
	if err != nil {
		return errors.Trace(err)
	}
	return nil
}
642249
func (s *Dataset) SetActions(v []*DatasetAction) *Dataset {
	s.Actions = v
	return s
}
267271
func (s *JobData) SetActionConfiguration(v *ActionConfiguration) *JobData {
	s.ActionConfiguration = v
	return s
}
1056346
func loadConfigIntervalActions() error {

	intervalActions := Configuration.IntervalActions

	for ia := range intervalActions {
		intervalAction := contract.IntervalAction{
			Name:       intervalActions[ia].Name,
			Interval:   intervalActions[ia].Interval,
			Parameters: intervalActions[ia].Parameters,
			Target:     intervalActions[ia].Target,
			Path:       intervalActions[ia].Path,
			Port:       intervalActions[ia].Port,
			Protocol:   intervalActions[ia].Protocol,
			HTTPMethod: intervalActions[ia].Method,
			Address:    intervalActions[ia].Host,
		}

		// query scheduler in memory queue and determine of intervalAction exists
		_, err := scClient.QueryIntervalActionByName(intervalAction.Name)

		if err != nil {

			// add the interval action to support-scheduler database
			newIntervalActionID, err := addIntervalActionToSchedulerDB(intervalAction)
			if err != nil {
				LoggingClient.Error("problem adding interval action into support-scheduler database:" + err.Error())
				return err
			}

			// add the support-scheduler version of the intervalAction.ID
			intervalAction.ID = newIntervalActionID
			//TODO: Do we care about the Created,Modified, or Origin fields?

			errAddIntervalAction := scClient.AddIntervalActionToQueue(intervalAction)
			if errAddIntervalAction != nil {
				LoggingClient.Error("problem loading interval action into support-scheduler:" + errAddIntervalAction.Error())
				return errAddIntervalAction

			}
		} else {
			LoggingClient.Debug("did not load interval action as it exists in the scheduler database:" + intervalAction.Name)
		}
	}
	return nil
}
1325893
func (a *FlagClause) HintAction(action HintAction) *FlagClause {
	a.addHintAction(action)
	return a
}
1344839
func (s *ActionType) SetSettings(v *ActionTypeSettings) *ActionType {
	s.Settings = v
	return s
}
437367
func (s *Session) UserSettings() (st *Settings, err error) {

	body, err := s.RequestWithBucketID("GET", EndpointUserSettings("@me"), nil, EndpointUserSettings(""))
	if err != nil {
		return
	}

	err = unmarshal(body, &st)
	return
}
1033193
func UnmarshalHandlerSettings(publicSettings, protectedSettings map[string]interface{}, publicV, protectedV interface{}) error {
	if err := unmarshalSettings(publicSettings, &publicV); err != nil {
		return fmt.Errorf("failed to unmarshal public settings: %v", err)
	}
	if err := unmarshalSettings(protectedSettings, &protectedV); err != nil {
		return fmt.Errorf("failed to unmarshal protected settings: %v", err)
	}
	return nil
}
814290
func addReceivedIntervalActions(intervalActions []contract.IntervalAction) error {
	for _, intervalAction := range intervalActions {
		err := scClient.AddIntervalActionToQueue(intervalAction)
		if err != nil {
			LoggingClient.Info("problem adding support-scheduler interval action", "name:", intervalAction.Name, "message", err.Error())
			return err
		}
		LoggingClient.Info("added interval action", "name", intervalAction.Name, "id", intervalAction.ID)
	}
	return nil
}
706060
func (g *Generator) AddProcessRlimits(rType string, rHard uint64, rSoft uint64) {
	g.initConfigProcess()
	for i, rlimit := range g.Config.Process.Rlimits {
		if rlimit.Type == rType {
			g.Config.Process.Rlimits[i].Hard = rHard
			g.Config.Process.Rlimits[i].Soft = rSoft
			return
		}
	}

	newRlimit := rspec.POSIXRlimit{
		Type: rType,
		Hard: rHard,
		Soft: rSoft,
	}
	g.Config.Process.Rlimits = append(g.Config.Process.Rlimits, newRlimit)
}
640935
func (actor Actor) UpdateApplicationSettings(pushPlans []PushPlan) ([]PushPlan, Warnings, error) {
	appNames := actor.getAppNames(pushPlans)
	applications, getWarnings, err := actor.V7Actor.GetApplicationsByNamesAndSpace(appNames, pushPlans[0].SpaceGUID)
	warnings := Warnings(getWarnings)
	if err != nil {
		log.Errorln("Looking up applications:", err)
		return nil, warnings, err
	}

	nameToApp := actor.generateAppNameToApplicationMapping(applications)

	var updatedPushPlans []PushPlan
	for _, pushPlan := range pushPlans {
		app := nameToApp[pushPlan.Application.Name]
		pushPlan.Application.GUID = app.GUID
		pushPlan.Application.State = app.State

		updatedPushPlans = append(updatedPushPlans, pushPlan)
	}

	return updatedPushPlans, warnings, err
}
602970
func (t Modules) BeforeActions(usedModules ...Module) Actions {
	actions := Actions{}
	modules := t.DependOnce(usedModules...)
	for _, module := range modules {
		actions.Add(module.Before)
	}
	return actions
}
944960
func (b *Bucket) AddAction(act Action) {
	b.Actions = append(b.Actions, act)
}
1307664
func (u *UniterAPI) UpdateSettings(args params.RelationUnitsSettings) (params.ErrorResults, error) {
	result := params.ErrorResults{
		Results: make([]params.ErrorResult, len(args.RelationUnits)),
	}
	canAccess, err := u.accessUnit()
	if err != nil {
		return params.ErrorResults{}, err
	}
	for i, arg := range args.RelationUnits {
		unit, err := names.ParseUnitTag(arg.Unit)
		if err != nil {
			result.Results[i].Error = common.ServerError(common.ErrPerm)
			continue
		}
		relUnit, err := u.getRelationUnit(canAccess, arg.Relation, unit)
		if err == nil {
			var settings *state.Settings
			settings, err = relUnit.Settings()
			if err == nil {
				for k, v := range arg.Settings {
					if v == "" {
						settings.Delete(k)
					} else {
						settings.Set(k, v)
					}
				}
				_, err = settings.Write()
			}
		}
		result.Results[i].Error = common.ServerError(err)
	}
	return result, nil
}
411898
func (s *CompromisedCredentialsRiskConfigurationType) SetActions(v *CompromisedCredentialsActionsType) *CompromisedCredentialsRiskConfigurationType {
	s.Actions = v
	return s
}
372367
func (s *UpdatePresetInput) SetSettings(v *PresetSettings) *UpdatePresetInput {
	s.Settings = v
	return s
}
586986
func PruneActions(st *State, maxHistoryTime time.Duration, maxHistoryMB int) error {
	err := pruneCollection(st, maxHistoryTime, maxHistoryMB, actionsC, "completed", GoTime)
	return errors.Trace(err)
}