Example usage for com.amazonaws.services.lambda AWSLambda publishVersion

List of usage examples for com.amazonaws.services.lambda AWSLambda publishVersion

Introduction

In this page you can find the example usage for com.amazonaws.services.lambda AWSLambda publishVersion.

Prototype

PublishVersionResult publishVersion(PublishVersionRequest publishVersionRequest);

Source Link

Document

<p> Creates a <a href="https://docs.aws.amazon.com/lambda/latest/dg/versioning-aliases.html">version</a> from the current code and configuration of a function.

Usage

From source file:jp.classmethod.aws.gradle.lambda.AWSLambdaPublishVersionTask.java

License:Apache License

@TaskAction
public void publishVersion() {

    final String functionName = getFunctionName();

    if (functionName == null) {
        throw new GradleException("functionName is required");
    }/*from w w w . j  av a2 s  .  c  om*/

    final AWSLambda lambda = getAwsLambdaClient();

    PublishVersionRequest request = new PublishVersionRequest().withFunctionName(functionName);

    if (getCodeSha256() != null) {
        request.withCodeSha256(getCodeSha256());
    }
    if (getDescription() != null) {
        request.withDescription(getDescription());
    }

    publishVersionResult = lambda.publishVersion(request);

    getLogger().info("Publish lambda version for {} succeeded with version {}", functionName,
            publishVersionResult.getVersion());
}