-
Notifications
You must be signed in to change notification settings - Fork 48
/
cmd_execute_build.go
41 lines (36 loc) · 1.5 KB
/
cmd_execute_build.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//go:build !lambdabinary
// +build !lambdabinary
package sparta
import (
gof "github.com/awslabs/goformation/v5/cloudformation"
"github.com/pkg/errors"
"github.com/rs/zerolog"
)
// StampedBuildID is the buildID stamped into the binary. For the case of a
// local build this is set by the provision command and the same value
// is stamped into the cross compiled binary at AWS Lambda execution time
var StampedBuildID string
// Execute creates an HTTP listener to dispatch execution. Typically
// called via Main() via command line arguments.
func Execute(serviceName string,
lambdaAWSInfos []*LambdaAWSInfo,
logger *zerolog.Logger) error {
// Execute no longer supported in non AWS binaries...
return errors.Errorf("Execute not supported outside of AWS Lambda environment")
}
// awsLambdaFunctionName returns the name of the function, which
// is set in the CloudFormation template that is published
// into the container as `AWS_LAMBDA_FUNCTION_NAME`. The function name
// is dependent on the CloudFormation stack name so that
// CodePipeline based builds can properly create unique FunctionNAmes
// within an account
func awsLambdaFunctionName(internalFunctionName string) string {
sanitizedName := awsLambdaInternalName(internalFunctionName)
// When we build, we return a gof.Join that
// will use the stack name and the internal name. When we run, we're going
// to use the name discovered from the environment.
return gof.Join("", []string{
gof.Ref("AWS::StackName"),
functionNameDelimiter,
sanitizedName})
}