Documentation ¶
Index ¶
- func GradualRollOut(client *lambda.Lambda, lambdaPackage LambdaPackage, version string, ...) (string, error)
- func HealthCheck(client *lambda.Lambda, lambdaPackage LambdaPackage, version string, ...) ([]int64, error)
- func LambdaClient(region string) *lambda.Lambda
- func S3Client(region string) *s3.S3
- type HealthCheckResponse
- type LambdaAlias
- type LambdaBucket
- type LambdaFunction
- type LambdaNewVersionResponse
- type LambdaPackage
- type LambdaUpdateAliasResponse
- type LambdaUpdateFunctionResponse
- type S3UploadResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GradualRollOut ¶
func GradualRollOut( client *lambda.Lambda, lambdaPackage LambdaPackage, version string, traffic float64, runs int, sleep time.Duration, payload []byte, ) (string, error)
GradualRollOut is the main function for gradual rollouts. It takes a version argument that refers to the new version that traffic is going to be shifted for. traffic stands for the amount of traffic to be shifted on each step. For example, 0.05 stands for 5%, and 20 steps is going to be required for a full rollout (100/5=20). runs argument stands for number of health checks you would like to run on each step. sleep is number of seconds to sleep on each step. And finally, payload can be used as a request body to send when running health checks.
func HealthCheck ¶
func HealthCheck( client *lambda.Lambda, lambdaPackage LambdaPackage, version string, payload []byte, ) ([]int64, error)
HealthCheck runs health checks on a given lambda version or alias. It can take a payload argument that be used to satisfy request body expectations of a lambda.
func LambdaClient ¶
LambdaClient initializes a new lambda client that can be used in lambda actions. Endpoint will be set to a localstack endpoint when running tests, otherwise it will use the default AWS location.
Types ¶
type HealthCheckResponse ¶
A HealthCheckResponse is used to reflect structure of a health check call targeting a lambda function. StatusCode stands for the HTTP status code returned by AWS. On the other hand, there can be an additional status code returned by applications in the response body, but this is optional.
type LambdaAlias ¶
type LambdaAlias struct {
Name string
}
A LambdaAlias is used to reflect structure of a lambda alias. Lambda aliases are used in traffic shifthing and gradual deployments.
type LambdaBucket ¶
A LambdaBucket is used to reflect structure of an AWS S3 bucket that is used to store lambda functions.
type LambdaFunction ¶
type LambdaFunction struct {
Name string
}
A LambdaFunction is used to reflect structure of an AWS Lambda function.
type LambdaNewVersionResponse ¶
type LambdaNewVersionResponse struct { FunctionArn string LastModified string LastUpdateStatus string State string Version string }
LambdaNewVersionResponse is used to represent the response returned from PublishNewVersion. The main use case of this struct is to check version number of the latest published version.
func PublishNewVersion ¶
func PublishNewVersion( client *lambda.Lambda, lambdaPackage LambdaPackage, ) (LambdaNewVersionResponse, error)
PublishNewVersion publishes a new lambda version and returns a LambdaNewVersionResponse. One of the most important fields in the response is Version, that is the new published version and is used in later gradual deployment steps.
type LambdaPackage ¶
type LambdaPackage struct { Location string Function LambdaFunction Bucket LambdaBucket Alias LambdaAlias }
A LambdaPackage is an internal representation of a lambda function that can be deployed gradually. LambdaPackage is a composite struct made of other structs.
type LambdaUpdateAliasResponse ¶
type LambdaUpdateAliasResponse struct { AliasArn string AliasName string CurrentVersion string NewVersion string CurrentWeight float64 }
LambdaUpdateAliasResponse is used to represent the response returned from UpdateAlias. The main use case of this struct is to track traffic shifted from one version to another.
func FullRollOut ¶
func FullRollOut( client *lambda.Lambda, lambdaPackage LambdaPackage, version string, ) (LambdaUpdateAliasResponse, error)
FullRollOut resets the routing config and shifts whole traffic from the new version to the alias. It returns a LambdaUpdateAliasResponse struct.
func UpdateAlias ¶
func UpdateAlias( client *lambda.Lambda, lambdaPackage LambdaPackage, version string, traffic float64, ) (LambdaUpdateAliasResponse, error)
UpdateAlias is used to shift traffic from one version to another. version argument is the version to shift some traffic, and traffic argument stands for the amount of traffic to be shifted. For example, 0.2 means 20% traffic shift to the specified version.
type LambdaUpdateFunctionResponse ¶
type LambdaUpdateFunctionResponse struct { FunctionArn string FunctionName string LastUpdateStatus string }
LambdaUpdateFunctionResponse is used to reflect the response returned from UpdateFunctionCode function.
func UpdateFunctionCode ¶
func UpdateFunctionCode( client *lambda.Lambda, lambdaPackage LambdaPackage, ) (LambdaUpdateFunctionResponse, error)
UpdateFunctionCode updates the function code of a lambda located on $LATEST. In later stages, new versions can be created from the updated $LATEST.
type S3UploadResponse ¶
type S3UploadResponse struct {
ETag string
}
An S3UploadResponse is used to represent structure of a response returned from an UploadToS3 call. It supports S3 buckets with versioning enabled or disabled.
func UploadToS3 ¶
func UploadToS3(client *s3.S3, lambdaPackage LambdaPackage) (S3UploadResponse, error)
UploadToS3 uploads a given lambda package to an S3 bucket. Later, the object in the bucket can be used for deploying the lambda function.