Skip to content

Commit

Permalink
Add inline comments to some functions
Browse files Browse the repository at this point in the history
  • Loading branch information
msdundar committed Jun 13, 2021
1 parent ee184b0 commit aea2e8f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lambda_publish_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"github.com/aws/aws-sdk-go/service/lambda"
)

// 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.
type LambdaNewVersionResponse struct {
FunctionArn string
LastModified string
Expand All @@ -15,6 +18,10 @@ type LambdaNewVersionResponse struct {
Version string
}

// 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.
func PublishNewVersion(
client *lambda.Lambda,
lambdaPackage LambdaPackage,
Expand Down
2 changes: 2 additions & 0 deletions lambda_publish_version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"time"
)

// TestPublishNewVersion publishes a new lambda version by calling
// PublishNewVersion and tests the output.
func TestPublishNewVersion(t *testing.T) {
lambdaClient := LambdaClient(os.Getenv("AWS_REGION"))

Expand Down
7 changes: 7 additions & 0 deletions lambda_update_alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"github.com/aws/aws-sdk-go/service/lambda"
)

// 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.
type LambdaUpdateAliasResponse struct {
AliasArn string
AliasName string
Expand All @@ -13,6 +16,10 @@ type LambdaUpdateAliasResponse struct {
CurrentWeight float64
}

// 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.
func UpdateAlias(
client *lambda.Lambda,
lambdaPackage LambdaPackage,
Expand Down

0 comments on commit aea2e8f

Please sign in to comment.