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

Method removeLambdaPermission

internal/deploy/triggers.go:99–120  ·  view source on GitHub ↗
(ctx context.Context, functionArn string)

Source from the content-addressed store, hash-verified

97}
98
99func (t *TriggerDeployer) removeLambdaPermission(ctx context.Context, functionArn string) error {
100 statementId := fmt.Sprintf("s3-trigger-%s", t.cfg.Deployment.StackName)
101
102 input := &lambda.RemovePermissionInput{
103 FunctionName: aws.String(functionArn),
104 StatementId: aws.String(statementId),
105 }
106
107 _, err := t.clients.Lambda.RemovePermissionWithContext(ctx, input)
108 if err != nil {
109 if awsErr, ok := err.(awserr.Error); ok {
110 if awsErr.Code() == lambda.ErrCodeResourceNotFoundException {
111 // Permission doesn't exist, which is fine
112 return nil
113 }
114 }
115 return err
116 }
117
118 log.Printf("Removed Lambda permission")
119 return nil
120}
121
122func (t *TriggerDeployer) configureBucketNotification(ctx context.Context, bucketName, functionArn string) error {
123 // Create notification configuration

Callers 1

RemoveS3TriggersMethod · 0.95

Calls 1

Tested by

no test coverage detected