DeleteLambdaFunction deletes a Lambda function
(ctx context.Context)
| 74 | |
| 75 | // DeleteLambdaFunction deletes a Lambda function |
| 76 | func (d *LambdaDeployer) DeleteLambdaFunction(ctx context.Context) error { |
| 77 | functionName := d.getFunctionName() |
| 78 | |
| 79 | log.Printf("Deleting Lambda function: %s", functionName) |
| 80 | |
| 81 | input := &lambda.DeleteFunctionInput{ |
| 82 | FunctionName: aws.String(functionName), |
| 83 | } |
| 84 | |
| 85 | _, err := d.clients.Lambda.DeleteFunctionWithContext(ctx, input) |
| 86 | if err != nil { |
| 87 | if awsErr, ok := err.(awserr.Error); ok { |
| 88 | if awsErr.Code() == lambda.ErrCodeResourceNotFoundException { |
| 89 | log.Printf("Function %s does not exist", functionName) |
| 90 | return nil |
| 91 | } |
| 92 | } |
| 93 | return fmt.Errorf("failed to delete function: %w", err) |
| 94 | } |
| 95 | |
| 96 | log.Printf("Lambda function deleted successfully") |
| 97 | return nil |
| 98 | } |
| 99 | |
| 100 | // GetFunctionInfo retrieves information about a Lambda function |
| 101 | func (d *LambdaDeployer) GetFunctionInfo(ctx context.Context) (*LambdaDeployResult, error) { |
no test coverage detected