All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.lambda.Alias Maven / Gradle / Ivy

There is a newer version: 1.204.0
Show newest version
package software.amazon.awscdk.services.lambda;

/**
 * A new alias to a particular version of a Lambda function.
 * 

* Example: *

*

 * CfnParametersCode lambdaCode = Code.fromCfnParameters();
 * Function func = Function.Builder.create(this, "Lambda")
 *         .code(lambdaCode)
 *         .handler("index.handler")
 *         .runtime(Runtime.NODEJS_14_X)
 *         .build();
 * // used to make sure each CDK synthesis produces a different Version
 * Version version = func.getCurrentVersion();
 * Alias alias = Alias.Builder.create(this, "LambdaAlias")
 *         .aliasName("Prod")
 *         .version(version)
 *         .build();
 * LambdaDeploymentGroup.Builder.create(this, "DeploymentGroup")
 *         .alias(alias)
 *         .deploymentConfig(LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE)
 *         .build();
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.74.0 (build 6d08790)", date = "2023-03-14T16:25:29.609Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.lambda.$Module.class, fqn = "@aws-cdk/aws-lambda.Alias") public class Alias extends software.amazon.awscdk.services.lambda.QualifiedFunctionBase implements software.amazon.awscdk.services.lambda.IAlias { protected Alias(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected Alias(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Alias(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.AliasProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param attrs This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IAlias fromAliasAttributes(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.AliasAttributes attrs) { return software.amazon.jsii.JsiiObject.jsiiStaticCall(software.amazon.awscdk.services.lambda.Alias.class, "fromAliasAttributes", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.IAlias.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(attrs, "attrs is required") }); } /** * Configure provisioned concurrency autoscaling on a function alias. *

* Returns a scalable attribute that can call * scaleOnUtilization() and scaleOnSchedule(). *

* @param options Autoscaling options. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IScalableFunctionAttribute addAutoScaling(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.AutoScalingOptions options) { return software.amazon.jsii.Kernel.call(this, "addAutoScaling", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.IScalableFunctionAttribute.class), new Object[] { java.util.Objects.requireNonNull(options, "options is required") }); } /** * Return the given named metric for this Function. *

* @param metricName This parameter is required. * @param props */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.cloudwatch.Metric metric(final @org.jetbrains.annotations.NotNull java.lang.String metricName, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.cloudwatch.MetricOptions props) { return software.amazon.jsii.Kernel.call(this, "metric", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.cloudwatch.Metric.class), new Object[] { java.util.Objects.requireNonNull(metricName, "metricName is required"), props }); } /** * Return the given named metric for this Function. *

* @param metricName This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.cloudwatch.Metric metric(final @org.jetbrains.annotations.NotNull java.lang.String metricName) { return software.amazon.jsii.Kernel.call(this, "metric", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.cloudwatch.Metric.class), new Object[] { java.util.Objects.requireNonNull(metricName, "metricName is required") }); } /** * Name of this alias. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getAliasName() { return software.amazon.jsii.Kernel.get(this, "aliasName", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The architecture of this Lambda Function. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.Architecture getArchitecture() { return software.amazon.jsii.Kernel.get(this, "architecture", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.Architecture.class)); } /** * Whether the addPermission() call adds any permissions. *

* True for new Lambdas, false for version $LATEST and imported Lambdas * from different accounts. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) protected @org.jetbrains.annotations.NotNull java.lang.Boolean getCanCreatePermissions() { return software.amazon.jsii.Kernel.get(this, "canCreatePermissions", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class)); } /** * ARN of this alias. *

* Used to be able to use Alias in place of a regular Lambda. Lambda accepts * ARNs everywhere it accepts function names. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getFunctionArn() { return software.amazon.jsii.Kernel.get(this, "functionArn", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * ARN of this alias. *

* Used to be able to use Alias in place of a regular Lambda. Lambda accepts * ARNs everywhere it accepts function names. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getFunctionName() { return software.amazon.jsii.Kernel.get(this, "functionName", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The principal this Lambda Function is running as. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IPrincipal getGrantPrincipal() { return software.amazon.jsii.Kernel.get(this, "grantPrincipal", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IPrincipal.class)); } /** */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IFunction getLambda() { return software.amazon.jsii.Kernel.get(this, "lambda", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.IFunction.class)); } /** * The qualifier of the version or alias of this function. *

* A qualifier is the identifier that's appended to a version or alias ARN. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) protected @org.jetbrains.annotations.NotNull java.lang.String getQualifier() { return software.amazon.jsii.Kernel.get(this, "qualifier", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The underlying Lambda function version. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.IVersion getVersion() { return software.amazon.jsii.Kernel.get(this, "version", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.IVersion.class)); } /** * The IAM role associated with this function. *

* Undefined if the function was imported without a role. */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.iam.IRole getRole() { return software.amazon.jsii.Kernel.get(this, "role", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IRole.class)); } /** * A fluent builder for {@link software.amazon.awscdk.services.lambda.Alias}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static final class Builder implements software.amazon.jsii.Builder { /** * @return a new instance of {@link Builder}. * @param scope This parameter is required. * @param id This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.constructs.Construct scope, final java.lang.String id) { return new Builder(scope, id); } private final software.constructs.Construct scope; private final java.lang.String id; private final software.amazon.awscdk.services.lambda.AliasProps.Builder props; private Builder(final software.constructs.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; this.props = new software.amazon.awscdk.services.lambda.AliasProps.Builder(); } /** * The maximum age of a request that Lambda sends to a function for processing. *

* Minimum: 60 seconds * Maximum: 6 hours *

* Default: Duration.hours(6) *

* @return {@code this} * @param maxEventAge The maximum age of a request that Lambda sends to a function for processing. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder maxEventAge(final software.amazon.awscdk.core.Duration maxEventAge) { this.props.maxEventAge(maxEventAge); return this; } /** * The destination for failed invocations. *

* Default: - no destination *

* @return {@code this} * @param onFailure The destination for failed invocations. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder onFailure(final software.amazon.awscdk.services.lambda.IDestination onFailure) { this.props.onFailure(onFailure); return this; } /** * The destination for successful invocations. *

* Default: - no destination *

* @return {@code this} * @param onSuccess The destination for successful invocations. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder onSuccess(final software.amazon.awscdk.services.lambda.IDestination onSuccess) { this.props.onSuccess(onSuccess); return this; } /** * The maximum number of times to retry when the function returns an error. *

* Minimum: 0 * Maximum: 2 *

* Default: 2 *

* @return {@code this} * @param retryAttempts The maximum number of times to retry when the function returns an error. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder retryAttempts(final java.lang.Number retryAttempts) { this.props.retryAttempts(retryAttempts); return this; } /** * Additional versions with individual weights this alias points to. *

* Individual additional version weights specified here should add up to * (less than) one. All remaining weight is routed to the default * version. *

* For example, the config is *

*

         * version: "1"
         * additionalVersions: [{ version: "2", weight: 0.05 }]
         * 
*

* Then 5% of traffic will be routed to function version 2, while * the remaining 95% of traffic will be routed to function version 1. *

* Default: No additional versions *

* @return {@code this} * @param additionalVersions Additional versions with individual weights this alias points to. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder additionalVersions(final java.util.List additionalVersions) { this.props.additionalVersions(additionalVersions); return this; } /** * Description for the alias. *

* Default: No description *

* @return {@code this} * @param description Description for the alias. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder description(final java.lang.String description) { this.props.description(description); return this; } /** * Specifies a provisioned concurrency configuration for a function's alias. *

* Default: No provisioned concurrency *

* @return {@code this} * @param provisionedConcurrentExecutions Specifies a provisioned concurrency configuration for a function's alias. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder provisionedConcurrentExecutions(final java.lang.Number provisionedConcurrentExecutions) { this.props.provisionedConcurrentExecutions(provisionedConcurrentExecutions); return this; } /** * Name of this alias. *

* @return {@code this} * @param aliasName Name of this alias. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder aliasName(final java.lang.String aliasName) { this.props.aliasName(aliasName); return this; } /** * Function version this alias refers to. *

* Use lambda.currentVersion to reference a version with your latest changes. *

* @return {@code this} * @param version Function version this alias refers to. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder version(final software.amazon.awscdk.services.lambda.IVersion version) { this.props.version(version); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.lambda.Alias}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.lambda.Alias build() { return new software.amazon.awscdk.services.lambda.Alias( this.scope, this.id, this.props.build() ); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy