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

Method DeployLambdaFunction

internal/deploy/lambda.go:52–73  ·  view source on GitHub ↗

DeployLambdaFunction deploys or updates a Lambda function

(ctx context.Context, zipPath, roleArn string)

Source from the content-addressed store, hash-verified

50
51// DeployLambdaFunction deploys or updates a Lambda function
52func (d *LambdaDeployer) DeployLambdaFunction(ctx context.Context, zipPath, roleArn string) (*LambdaDeployResult, error) {
53 functionName := d.getFunctionName()
54
55 log.Printf("Deploying Lambda function: %s", functionName)
56
57 // Read the deployment package
58 zipData, err := os.ReadFile(zipPath)
59 if err != nil {
60 return nil, fmt.Errorf("failed to read deployment package: %w", err)
61 }
62
63 exists, err := d.functionExists(ctx, functionName)
64 if err != nil {
65 return nil, fmt.Errorf("failed to check if function exists: %w", err)
66 }
67
68 if exists {
69 return d.updateFunction(ctx, functionName, zipData)
70 }
71
72 return d.createFunction(ctx, functionName, zipData, roleArn)
73}
74
75// DeleteLambdaFunction deletes a Lambda function
76func (d *LambdaDeployer) DeleteLambdaFunction(ctx context.Context) error {

Callers 1

runDeployFunction · 0.95

Calls 4

getFunctionNameMethod · 0.95
functionExistsMethod · 0.95
updateFunctionMethod · 0.95
createFunctionMethod · 0.95

Tested by

no test coverage detected