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

Method waitForFunctionUpdated

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

Source from the content-addressed store, hash-verified

261}
262
263func (d *LambdaDeployer) waitForFunctionUpdated(ctx context.Context, functionName string) error {
264 log.Printf("Waiting for function update to complete...")
265
266 checkFn := func() (bool, error) {
267 input := &lambda.GetFunctionInput{
268 FunctionName: aws.String(functionName),
269 }
270
271 result, err := d.clients.Lambda.GetFunctionWithContext(ctx, input)
272 if err != nil {
273 return false, err
274 }
275
276 lastUpdateStatus := *result.Configuration.LastUpdateStatus
277 log.Printf("Function update status: %s", lastUpdateStatus)
278
279 if lastUpdateStatus == lambda.LastUpdateStatusFailed {
280 return false, fmt.Errorf("function update failed")
281 }
282
283 return lastUpdateStatus == lambda.LastUpdateStatusSuccessful, nil
284 }
285
286 return awsclients.WaitForOperation(ctx, checkFn, 5*time.Minute)
287}
288
289func (d *LambdaDeployer) extractFunctionInfo(config *lambda.FunctionConfiguration) *LambdaDeployResult {
290 result := &LambdaDeployResult{

Callers 1

updateFunctionMethod · 0.95

Calls 1

Tested by

no test coverage detected