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

Method RemoveS3Triggers

internal/deploy/triggers.go:57–69  ·  view source on GitHub ↗

RemoveS3Triggers removes S3 bucket notifications and Lambda permissions

(ctx context.Context, bucketName, functionArn string)

Source from the content-addressed store, hash-verified

55
56// RemoveS3Triggers removes S3 bucket notifications and Lambda permissions
57func (t *TriggerDeployer) RemoveS3Triggers(ctx context.Context, bucketName, functionArn string) error {
58 // Remove bucket notification first
59 if err := t.removeBucketNotification(ctx, bucketName); err != nil {
60 log.Printf("Warning: failed to remove bucket notification: %v", err)
61 }
62
63 // Remove Lambda permission
64 if err := t.removeLambdaPermission(ctx, functionArn); err != nil {
65 log.Printf("Warning: failed to remove Lambda permission: %v", err)
66 }
67
68 return nil
69}
70
71func (t *TriggerDeployer) addLambdaPermission(ctx context.Context, functionArn, bucketName string) error {
72 statementId := fmt.Sprintf("s3-trigger-%s", t.cfg.Deployment.StackName)

Callers 1

cleanupS3ResourcesFunction · 0.95

Calls 2

Tested by

no test coverage detected