// matchingActions finds actions that match ActionReceiver.
973941
func (st *State) matchingActions(ar ActionReceiver) ([]Action, error) {
	return st.matchingActionsByReceiverId(ar.Tag().Id())
}
1144279
func (s *ApplicationPolicyStatement) SetActions(v []*string) *ApplicationPolicyStatement {
	s.Actions = v
	return s
}
753395
func (r *Rules) MatchingRules(c context.Context, serviceAccount string) ([]*Rule, error) {
	// TODO(vadimsh): This will not scale when the number of rules becomes large.
	// At some point we'll have to give up the perfect consistency and start
	// caching the results.

	// Set of rules that match the service account. If the service account matches
	// some rule via multiple different groups, this is NOT an error, since
	// there's no ambiguity in this case.
	matchingRules := make(map[*Rule]struct{}, 1)

	// Query all groups mentioned in the config to figure out which ones the
	// account belongs to and then pick the corresponding rules.
	if len(r.groups) != 0 {
		ident := identity.Identity("user:" + serviceAccount)
		groups, err := auth.GetState(c).DB().CheckMembership(c, ident, r.groups)
		if err != nil {
			return nil, errors.Annotate(err, "failed to check membership of %s", serviceAccount).Err()
		}
		for _, g := range groups {
			matchingRules[r.rulesPerGroup[g]] = struct{}{}
		}
	}

	// Try rules with explicitly mentioned accounts too.
	if rule := r.rulesPerAcc[serviceAccount]; rule != nil {
		matchingRules[rule] = struct{}{}
	}

	// Convert to an array and sort for deterministic error messages.
	out := make([]*Rule, 0, len(matchingRules))
	for rule := range matchingRules {
		out = append(out, rule)
	}
	sort.Slice(out, func(i, j int) bool { return out[i].Rule.Name < out[j].Rule.Name })
	return out, nil
}
738312
func (f *Facade) RunningActions(args params.Entities) params.ActionsByReceivers {
	canAccess := f.accessMachine
	tagToActionReceiver := f.backend.TagToActionReceiverFn(f.backend.FindEntity)

	response := params.ActionsByReceivers{
		Actions: make([]params.ActionsByReceiver, len(args.Entities)),
	}

	for i, entity := range args.Entities {
		currentResult := &response.Actions[i]
		receiver, err := tagToActionReceiver(entity.Tag)
		if err != nil {
			currentResult.Error = common.ServerError(common.ErrBadId)
			continue
		}
		currentResult.Receiver = receiver.Tag().String()

		if !canAccess(receiver.Tag()) {
			currentResult.Error = common.ServerError(common.ErrPerm)
			continue
		}

		results, err := f.backend.ConvertActions(receiver, receiver.RunningActions)
		if err != nil {
			currentResult.Error = common.ServerError(err)
			continue
		}
		currentResult.Actions = results
	}

	return response
}
764538
func (s *StartFleetActionsInput) SetActions(v []*string) *StartFleetActionsInput {
	s.Actions = v
	return s
}
1367251
func (g *Gnostic) performActions(message proto.Message) (err error) {
	// Optionally resolve internal references.
	if g.resolveReferences {
		if g.sourceFormat == SourceFormatOpenAPI2 {
			document := message.(*openapi_v2.Document)
			_, err = document.ResolveReferences(g.sourceName)
		} else if g.sourceFormat == SourceFormatOpenAPI3 {
			document := message.(*openapi_v3.Document)
			_, err = document.ResolveReferences(g.sourceName)
		}
		if err != nil {
			return err
		}
	}
	// Optionally write proto in binary format.
	if g.binaryOutputPath != "" {
		g.writeBinaryOutput(message)
	}
	// Optionally write proto in text format.
	if g.textOutputPath != "" {
		g.writeTextOutput(message)
	}
	// Optionally write document in yaml and/or json formats.
	if g.yamlOutputPath != "" || g.jsonOutputPath != "" {
		g.writeJSONYAMLOutput(message)
	}
	// Call all specified plugins.
	messages := make([]*plugins.Message, 0)
	for _, p := range g.pluginCalls {
		pluginMessages, err := p.perform(message, g.sourceFormat, g.sourceName, g.timePlugins)
		if err != nil {
			writeFile(g.errorOutputPath, g.errorBytes(err), g.sourceName, "errors")
			defer os.Exit(-1) // run all plugins, even when some have errors
		}
		messages = append(messages, pluginMessages...)
	}
	if g.messageOutputPath != "" {
		g.writeMessagesOutput(&plugins.Messages{Messages: messages})
	} else {
		// Print any messages from the plugins
		if len(messages) > 0 {
			for _, message := range messages {
				fmt.Printf("%+v\n", message)
			}
		}
	}
	return nil
}
79982
func (s *UpdateDatasetInput) SetActions(v []*DatasetAction) *UpdateDatasetInput {
	s.Actions = v
	return s
}
210602
func (c *Card) GetActions(args Arguments) (actions ActionCollection, err error) {
	path := fmt.Sprintf("cards/%s/actions", c.ID)
	err = c.client.Get(path, args, &actions)
	return
}
964850
func (s *TasksCancelService) Actions(actions ...string) *TasksCancelService {
	s.actions = append(s.actions, actions...)
	return s
}
458037
func ContextAction(ctx context.Context) string {
	if a := ctx.Value(actionKey); a != nil {
		return a.(string)
	}
	return "<unknown>"
}
499700
func (r *Resource) WithAction(action string) *Resource {
	r.u.RawQuery = url.Values{
		"~action": []string{action},
	}.Encode()
	return r
}
1096692
func (s *StageDeclaration) SetActions(v []*ActionDeclaration) *StageDeclaration {
	s.Actions = v
	return s
}
514914
func (ctx *HookContext) UpdateActionResults(keys []string, value string) error {
	if ctx.actionData == nil {
		return errors.New("not running an action")
	}
	addValueToMap(keys, value, ctx.actionData.ResultsMap)
	return nil
}
507084
func (s *AccountTakeoverRiskConfigurationType) SetActions(v *AccountTakeoverActionsType) *AccountTakeoverRiskConfigurationType {
	s.Actions = v
	return s
}
1118135
func (s *CreateTriggerInput) SetActions(v []*Action) *CreateTriggerInput {
	s.Actions = v
	return s
}
34127
func (s *BulkProcessorService) BulkActions(bulkActions int) *BulkProcessorService {
	s.bulkActions = bulkActions
	return s
}
843073
func ConvertActions(ar state.ActionReceiver, fn GetActionsFn) ([]params.ActionResult, error) {
	items := []params.ActionResult{}
	actions, err := fn()
	if err != nil {
		return items, err
	}
	for _, action := range actions {
		if action == nil {
			continue
		}
		items = append(items, MakeActionResult(ar.Tag(), action))
	}
	return items, nil
}