MCPcopy Create free account
hub / github.com/dan-v/lambda-nat-proxy / waitForFunctionActive

Method waitForFunctionActive

internal/deploy/lambda.go:237–261  ·  view source on GitHub ↗
(ctx context.Context, functionName string)

Source from the content-addressed store, hash-verified

235}
236
237func (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
263func (d *LambdaDeployer) waitForFunctionUpdated(ctx context.Context, functionName string) error {
264 log.Printf("Waiting for function update to complete...")

Callers 1

createFunctionMethod · 0.95

Calls 1

Tested by

no test coverage detected