// ExecuteActionsByChangeset executes all actions given in the actionConfigs
// using the mapped configuration strings and returns the new context entity.
// It takes a []Change that describes the differences between the old and the new context.
161196
func ExecuteActionsByChangeset(ctx context.Context, db application.DB, userID uuid.UUID, newContext change.Detector, contextChanges []change.Change, actionConfigs map[string]string) (change.Detector, change.Set, error) {
	var actionChanges change.Set
	for actionKey := range actionConfigs {
		var err error
		actionConfig := actionConfigs[actionKey]
		switch actionKey {
		case rules.ActionKeyNil:
			newContext, actionChanges, err = executeAction(rules.ActionNil{}, actionConfig, newContext, contextChanges, &actionChanges)
		case rules.ActionKeyFieldSet:
			newContext, actionChanges, err = executeAction(rules.ActionFieldSet{
				Db:     db,
				Ctx:    ctx,
				UserID: &userID,
			}, actionConfig, newContext, contextChanges, &actionChanges)
		/* commented out for now until this rule is added
		case rules.ActionKeyStateToMetastate:
			newContext, actionChanges, err = executeAction(rules.ActionStateToMetaState{
				Db:     db,
				Ctx:    ctx,
				UserID: &userID,
			}, actionConfig, newContext, contextChanges, &actionChanges)
		*/
		default:
			return nil, nil, errs.New("action key " + actionKey + " is unknown")
		}
		if err != nil {
			return nil, nil, err
		}
	}
	return newContext, actionChanges, nil
}
1060957
func (c *Client) ActionBegin(tag names.ActionTag) error {
	var results params.ErrorResults

	args := params.Entities{
		Entities: []params.Entity{{Tag: tag.String()}},
	}

	err := c.facade.FacadeCall("BeginActions", args, &results)
	if err != nil {
		return errors.Trace(err)
	}

	return results.OneError()
}
218375
func (m *Model) EnqueueAction(receiver names.Tag, actionName string, payload map[string]interface{}) (Action, error) {
	if len(actionName) == 0 {
		return nil, errors.New("action name required")
	}

	receiverCollectionName, receiverId, err := m.st.tagToCollectionAndId(receiver)
	if err != nil {
		return nil, errors.Trace(err)
	}

	doc, ndoc, err := newActionDoc(m.st, receiver, actionName, payload)
	if err != nil {
		return nil, errors.Trace(err)
	}

	ops := []txn.Op{{
		C:      receiverCollectionName,
		Id:     receiverId,
		Assert: notDeadDoc,
	}, {
		C:      actionsC,
		Id:     doc.DocId,
		Assert: txn.DocMissing,
		Insert: doc,
	}, {
		C:      actionNotificationsC,
		Id:     ndoc.DocId,
		Assert: txn.DocMissing,
		Insert: ndoc,
	}}

	buildTxn := func(attempt int) ([]txn.Op, error) {
		if notDead, err := isNotDead(m.st, receiverCollectionName, receiverId); err != nil {
			return nil, err
		} else if !notDead {
			return nil, ErrDead
		} else if attempt != 0 {
			return nil, errors.Errorf("unexpected attempt number '%d'", attempt)
		}
		return ops, nil
	}
	if err = m.st.db().Run(buildTxn); err == nil {
		return newAction(m.st, doc), nil
	}
	return nil, err
}
545273
func (a *ActionAPI) Actions(arg params.Entities) (params.ActionResults, error) {
	if err := a.checkCanRead(); err != nil {
		return params.ActionResults{}, errors.Trace(err)
	}

	response := params.ActionResults{Results: make([]params.ActionResult, len(arg.Entities))}
	for i, entity := range arg.Entities {
		currentResult := &response.Results[i]
		tag, err := names.ParseTag(entity.Tag)
		if err != nil {
			currentResult.Error = common.ServerError(common.ErrBadId)
			continue
		}
		actionTag, ok := tag.(names.ActionTag)
		if !ok {
			currentResult.Error = common.ServerError(common.ErrBadId)
			continue
		}
		m, err := a.state.Model()
		if err != nil {
			return params.ActionResults{}, errors.Trace(err)
		}
		action, err := m.ActionByTag(actionTag)
		if err != nil {
			currentResult.Error = common.ServerError(common.ErrBadId)
			continue
		}
		receiverTag, err := names.ActionReceiverTag(action.Receiver())
		if err != nil {
			currentResult.Error = common.ServerError(err)
			continue
		}
		response.Results[i] = common.MakeActionResult(receiverTag, action)
	}
	return response, nil
}
1011280
func (r *resourceRecordSets) StartChangeset() dnsprovider.ResourceRecordChangeset {
	changeset := &resourceRecordChangeset{
		zone:               r.zone,
		resourceRecordSets: r,
	}
	return changeset
}
507084
func (s *AccountTakeoverRiskConfigurationType) SetActions(v *AccountTakeoverActionsType) *AccountTakeoverRiskConfigurationType {
	s.Actions = v
	return s
}
826102
func (c *Card) GetMembershipChangeActions() (actions ActionCollection, err error) {
	// We include updateCard:closed as if the member is implicitly removed from the card when it's closed.
	// This allows us to "close out" the duration length.
	return c.GetActions(Arguments{"filter": "addMemberToCard,removeMemberFromCard,updateCard:closed"})
}
408318
func getConfigurationAction(client *gocd.Client, c *cli.Context) (r interface{}, resp *gocd.APIResponse, err error) {
	return client.Configuration.Get(context.Background())
}
276602
func (act ActionNil) OnChange(newContext change.Detector, contextChanges change.Set, configuration string, actionChanges *change.Set) (change.Detector, change.Set, error) {
	return newContext, nil, nil
}
411898
func (s *CompromisedCredentialsRiskConfigurationType) SetActions(v *CompromisedCredentialsActionsType) *CompromisedCredentialsRiskConfigurationType {
	s.Actions = v
	return s
}
1108319
func (l Listener) OnContextActionChange(e *gumble.ContextActionChangeEvent) {
	if l.ContextActionChange != nil {
		l.ContextActionChange(e)
	}
}
129604
func (s *DatasetSummary) SetActions(v []*DatasetActionSummary) *DatasetSummary {
	s.Actions = v
	return s
}
881819
func (c *HookContext) ActionData() (*ActionData, error) {
	if c.actionData == nil {
		return nil, errors.New("not running an action")
	}
	return c.actionData, nil
}
707367
func (fa *failAction) Execute(state State) (*State, error) {
	if err := fa.callbacks.FailAction(fa.actionId, "action terminated"); err != nil {
		return nil, err
	}

	return stateChange{
		Kind:     RunAction,
		Step:     Done,
		ActionId: &fa.actionId,
		Hook:     state.Hook,
	}.apply(state), nil
}
461752
func FilterAction(methodRef interface{}) FilterConfigurator {
	var (
		methodValue = reflect.ValueOf(methodRef)
		methodType  = methodValue.Type()
	)
	if methodType.Kind() != reflect.Func || methodType.NumIn() == 0 {
		panic("Expecting a controller method reference (e.g. Controller.Action), got a " +
			methodType.String())
	}

	controllerType := methodType.In(0)
	method := FindMethod(controllerType, methodValue)
	if method == nil {
		panic("Action not found on controller " + controllerType.Name())
	}

	for controllerType.Kind() == reflect.Ptr {
		controllerType = controllerType.Elem()
	}

	return newFilterConfigurator(controllerType.Name(), method.Name)
}
1026658
func (s *CreateDatasetInput) SetActions(v []*DatasetAction) *CreateDatasetInput {
	s.Actions = v
	return s
}
247612
func (b *Bmattermost) replaceAction(text string) (string, bool) {
	if strings.HasPrefix(text, "*") && strings.HasSuffix(text, "*") {
		return strings.Replace(text, "*", "", -1), true
	}
	return text, false
}