(ctx context.Context, functionName string)
| 235 | } |
| 236 | |
| 237 | func (d *LambdaDeployer) waitForFunctionActive(ctx context.Context, functionName string) error { |
| 238 | log.Printf("Waiting for function to become active...") |
| 239 | |
| 240 | checkFn := func() (bool, error) { |
| 241 | input := &lambda.GetFunctionInput{ |
| 242 | FunctionName: aws.String(functionName), |
| 243 | } |
| 244 | |
| 245 | result, err := d.clients.Lambda.GetFunctionWithContext(ctx, input) |
| 246 | if err != nil { |
| 247 | return false, err |
| 248 | } |
| 249 | |
| 250 | state := *result.Configuration.State |
| 251 | log.Printf("Function state: %s", state) |
| 252 | |
| 253 | if state == lambda.StateFailed { |
| 254 | return false, fmt.Errorf("function is in failed state") |
| 255 | } |
| 256 | |
| 257 | return state == lambda.StateActive, nil |
| 258 | } |
| 259 | |
| 260 | return awsclients.WaitForOperation(ctx, checkFn, 5*time.Minute) |
| 261 | } |
| 262 | |
| 263 | func (d *LambdaDeployer) waitForFunctionUpdated(ctx context.Context, functionName string) error { |
| 264 | log.Printf("Waiting for function update to complete...") |
no test coverage detected