github.com/mweagle/Sparta@v1.15.0/sparta_constants.go (about) 1 package sparta 2 3 import ( 4 "fmt" 5 "strings" 6 7 _ "github.com/aws/aws-lambda-go/lambda" // Force dep to resolve 8 _ "github.com/aws/aws-lambda-go/lambdacontext" // Force dep to resolve 9 ) 10 11 //////////////////////////////////////////////////////////////////////////////// 12 // Constants 13 //////////////////////////////////////////////////////////////////////////////// 14 15 const ( 16 // ProperName is the DRY name definition 17 ProperName = "Sparta" 18 ) 19 const ( 20 // SpartaVersion defines the current Sparta release 21 SpartaVersion = "1.15.0" 22 // GoLambdaVersion is the Go version runtime used for the lambda function 23 GoLambdaVersion = "go1.x" 24 // LambdaBinaryTag is the build tag name used when building the binary 25 LambdaBinaryTag = "lambdabinary" 26 ) 27 28 var ( 29 // SpartaBinaryName is binary name that exposes the Go lambda function 30 SpartaBinaryName = fmt.Sprintf("%s.lambda.amd64", ProperName) 31 ) 32 33 const ( 34 // Custom Resource typename used to create new cloudFormationUserDefinedFunctionCustomResource 35 cloudFormationLambda = "Custom::SpartaLambdaCustomResource" 36 // divider length is the length of a divider in the text 37 // based CLI output 38 dividerLength = 48 39 ) 40 const ( 41 // envVarLogLevel is the provision time debug value 42 // carried into the execution environment 43 envVarLogLevel = "SPARTA_LOG_LEVEL" 44 // spartaEnvVarFunctionName is the name of this function in the 45 // map. It's the function that will be registered to run 46 // envVarFunctionName = "SPARTA_FUNC_NAME" 47 // envVarDiscoveryInformation is the name of the discovery information 48 // published into the environment 49 envVarDiscoveryInformation = "SPARTA_DISCOVERY_INFO" 50 ) 51 52 var ( 53 // internal logging header 54 headerDivider = strings.Repeat("═", dividerLength) 55 ) 56 57 // AWS Principal ARNs from http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html 58 // See also 59 // http://docs.aws.amazon.com/general/latest/gr/rande.html 60 // for region specific principal names 61 const ( 62 // @enum AWSPrincipal 63 APIGatewayPrincipal = "apigateway.amazonaws.com" 64 // @enum AWSPrincipal 65 CloudWatchEventsPrincipal = "events.amazonaws.com" 66 // @enum AWSPrincipal 67 SESPrincipal = "ses.amazonaws.com" 68 // @enum AWSPrincipal 69 SNSPrincipal = "sns.amazonaws.com" 70 // @enum AWSPrincipal 71 EC2Principal = "ec2.amazonaws.com" 72 // @enum AWSPrincipal 73 LambdaPrincipal = "lambda.amazonaws.com" 74 // @enum AWSPrincipal 75 ElasticLoadBalancingPrincipal = "elasticloadbalancing.amazonaws.com" 76 // @enum KinesisFirehosePrincipal 77 KinesisFirehosePrincipal = "firehose.amazonaws.com" 78 // @enum EventBridgePrincipal 79 EventBridgePrincipal = "events.amazonaws.com" 80 ) 81 82 type contextKey int 83 84 const ( 85 // ContextKeyLogger is the request-independent *logrus.Logger 86 // instance common to all requests 87 ContextKeyLogger contextKey = iota 88 // ContextKeyRequestLogger is the *logrus.Entry instance 89 // that is annotated with request-identifying 90 // information extracted from the AWS context object 91 ContextKeyRequestLogger 92 // ContextKeyLambdaContext is the *sparta.LambdaContext 93 // pointer in the request 94 // DEPRECATED 95 ContextKeyLambdaContext 96 // ContextKeyLambdaError is the possible error that was returned 97 // from the lambda function 98 ContextKeyLambdaError 99 // ContextKeyLambdaResponse is the possible response that 100 // was returned from the lambda function 101 ContextKeyLambdaResponse 102 // ContextKeyAWSSession is the aws Session instance for this 103 // request 104 ContextKeyAWSSession 105 )