//args: ActionName,ControllerName,AppName
160904
func (c *Context) TmplPath(args ...string) string {
	var app, ctl, act = c.App.Name, c.ControllerName, c.ActionName
	switch len(args) {
	case 3:
		app = args[2]
		fallthrough
	case 2:
		ctl = args[1]
		fallthrough
	case 1:
		act = args[0]
	}
	return app + `/` + ctl + `/` + act
}
903365
func (a *ActionAPI) ApplicationsCharmsActions(args params.Entities) (params.ApplicationsCharmActionsResults, error) {
	result := params.ApplicationsCharmActionsResults{Results: make([]params.ApplicationCharmActionsResult, len(args.Entities))}
	if err := a.checkCanWrite(); err != nil {
		return result, errors.Trace(err)
	}

	for i, entity := range args.Entities {
		currentResult := &result.Results[i]
		svcTag, err := names.ParseApplicationTag(entity.Tag)
		if err != nil {
			currentResult.Error = common.ServerError(common.ErrBadId)
			continue
		}
		currentResult.ApplicationTag = svcTag.String()
		svc, err := a.state.Application(svcTag.Id())
		if err != nil {
			currentResult.Error = common.ServerError(err)
			continue
		}
		ch, _, err := svc.Charm()
		if err != nil {
			currentResult.Error = common.ServerError(err)
			continue
		}
		if actions := ch.Actions(); actions != nil {
			charmActions := make(map[string]params.ActionSpec)
			for key, value := range actions.ActionSpecs {
				charmActions[key] = params.ActionSpec{
					Description: value.Description,
					Params:      value.Params,
				}
			}
			currentResult.Actions = charmActions
		}
	}
	return result, nil
}
985878
func NewActionData(name string, tag *names.ActionTag, params map[string]interface{}) *ActionData {
	return &ActionData{
		Name:       name,
		Tag:        *tag,
		Params:     params,
		ResultsMap: map[string]interface{}{},
	}
}
512856
func (a Action) String() string {
	// Fast path for only one action.
	if name, ok := actionToName[a]; ok {
		return name
	}
	// Slow path for many actions.
	var values []string
	for action, name := range actionToName {
		if action&a == action {
			values = append(values, name)
		}
	}
	return strings.Join(values, ", ")
}
965365
func funcMap(appPkg string, actionImpls map[string]string) template.FuncMap {
	return template.FuncMap{
		"tempvar":   tempvar,
		"okResp":    okResp,
		"targetPkg": func() string { return appPkg },
		"actionBody": func(name string) string {
			body, ok := actionImpls[name]
			if !ok {
				return defaultActionBody
			}
			return body
		},
		"printResp": func(name string) bool {
			_, ok := actionImpls[name]
			return !ok
		},
	}
}
1361822
func (s *ReviewActionDetail) SetActionName(v string) *ReviewActionDetail {
	s.ActionName = &v
	return s
}
1144389
func (ar *ActionRepository) RegisterKeyspaceAction(name string, method actionKeyspaceMethod) {
	ar.keyspaceActions[name] = method
}
244257
func (client *AMIClient) Action(action string, params Params) (*AMIResponse, error) {
	resp, err := client.AsyncAction(action, params)
	if err != nil {
		return nil, err
	}
	response := <-resp

	return response, nil
}
59056
func (p *PathParam) Args() []string {
	return []string{fmt.Sprintf("--%v", p.CLIName()), p.String()}
}
969394
func (a Action) String() string {
	switch a {
	case Insert:
		return "Insert"
	case Delete:
		return "Delete"
	case Modify:
		return "Modify"
	default:
		panic(fmt.Sprintf("unsupported action: %d", a))
	}
}
617047
func (c *Config) Args() []string {
	args := []string{}
	for _, p := range c.Params {
		args = append(args, p.Args()...)
	}
	return args
}
988533
func (s *XPackWatcherAckWatchService) ActionId(actionId ...string) *XPackWatcherAckWatchService {
	s.actionId = append(s.actionId, actionId...)
	return s
}
548950
func (c *showControllerCommand) Init(args []string) (err error) {
	c.controllerNames = args
	return nil
}
700498
func joinRouteParams(action *design.ActionDefinition, att *design.AttributeDefinition) string {
	var (
		params = action.Routes[0].Params()
		elems  = make([]string, len(params))
	)
	for i, p := range params {
		patt, ok := att.Type.ToObject()[p]
		if !ok {
			continue
		}
		pf := "cmd.%s"
		if patt.Type.Kind() == design.StringKind {
			pf = "url.QueryEscape(cmd.%s)"
		}
		field := fmt.Sprintf(pf, codegen.Goify(p, true))
		elems[i] = field
	}
	return strings.Join(elems, ", ")
}
961829
func (c *Controller) updateApplication(ch ApplicationChange) {
	c.ensureModel(ch.ModelUUID).updateApplication(ch, c.manager)
}
1036091
func (c *Container) actionURL(action string) string {
	return c.Endpoint + strings.Replace(action, actionPartSeparator, requestPartSeparator, -1)
}
538627
func makeParams(action string) map[string]string {
	params := make(map[string]string)
	params[ActionKey] = action
	return params
}