| 97 | } |
| 98 | |
| 99 | func parseBrn(ctx *InvokeContext) (brn.BRN, error) { |
| 100 | if functionBRN, err := brn.Parse(ctx.FunctionBRN); err != nil { |
| 101 | return functionBRN, err |
| 102 | } else { |
| 103 | ctx.CallerUser = &api.User{ |
| 104 | ID: functionBRN.AccountID, |
| 105 | } |
| 106 | resources := strings.Split(functionBRN.Resource, ":") |
| 107 | // eg: function:hello-tmp:$LATEST |
| 108 | if len(resources) == 3 { |
| 109 | ctx.FunctionName = resources[1] |
| 110 | ctx.Qualifier = resources[2] |
| 111 | } |
| 112 | return functionBRN, nil |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | func (controller *Controller) getFunction(ctx *InvokeContext) (hitCache bool, err error) { |
| 117 | if ctx.RunOptions.RecommendedOptions.Features.EnableMetrics { |