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

com.pulumi.aws.lambda.kotlin.LayerVersionArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.66.3.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.lambda.kotlin

import com.pulumi.asset.Archive
import com.pulumi.aws.lambda.LayerVersionArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Provides a Lambda Layer Version resource. Lambda Layers allow you to reuse shared bits of code across multiple lambda functions.
 * For information about Lambda Layers and how to use them, see [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html).
 * > **NOTE:** Setting `skip_destroy` to `true` means that the AWS Provider will _not_ destroy any layer version, even when running destroy. Layer versions are thus intentional dangling resources that are _not_ managed by the provider and may incur extra expense in your AWS account.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const lambdaLayer = new aws.lambda.LayerVersion("lambda_layer", {
 *     code: new pulumi.asset.FileArchive("lambda_layer_payload.zip"),
 *     layerName: "lambda_layer_name",
 *     compatibleRuntimes: ["nodejs16.x"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * lambda_layer = aws.lambda_.LayerVersion("lambda_layer",
 *     code=pulumi.FileArchive("lambda_layer_payload.zip"),
 *     layer_name="lambda_layer_name",
 *     compatible_runtimes=["nodejs16.x"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var lambdaLayer = new Aws.Lambda.LayerVersion("lambda_layer", new()
 *     {
 *         Code = new FileArchive("lambda_layer_payload.zip"),
 *         LayerName = "lambda_layer_name",
 *         CompatibleRuntimes = new[]
 *         {
 *             "nodejs16.x",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := lambda.NewLayerVersion(ctx, "lambda_layer", &lambda.LayerVersionArgs{
 * 			Code:      pulumi.NewFileArchive("lambda_layer_payload.zip"),
 * 			LayerName: pulumi.String("lambda_layer_name"),
 * 			CompatibleRuntimes: pulumi.StringArray{
 * 				pulumi.String("nodejs16.x"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.lambda.LayerVersion;
 * import com.pulumi.aws.lambda.LayerVersionArgs;
 * import com.pulumi.asset.FileArchive;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var lambdaLayer = new LayerVersion("lambdaLayer", LayerVersionArgs.builder()
 *             .code(new FileArchive("lambda_layer_payload.zip"))
 *             .layerName("lambda_layer_name")
 *             .compatibleRuntimes("nodejs16.x")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   lambdaLayer:
 *     type: aws:lambda:LayerVersion
 *     name: lambda_layer
 *     properties:
 *       code:
 *         fn::FileArchive: lambda_layer_payload.zip
 *       layerName: lambda_layer_name
 *       compatibleRuntimes:
 *         - nodejs16.x
 * ```
 * 
 * ## Specifying the Deployment Package
 * AWS Lambda Layers expect source code to be provided as a deployment package whose structure varies depending on which `compatible_runtimes` this layer specifies.
 * See [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) for the valid values of `compatible_runtimes`.
 * Once you have created your deployment package you can specify it either directly as a local file (using the `filename` argument) or
 * indirectly via Amazon S3 (using the `s3_bucket`, `s3_key` and `s3_object_version` arguments). When providing the deployment
 * package via S3 it may be useful to use the `aws.s3.BucketObjectv2` resource to upload it.
 * For larger deployment packages it is recommended by Amazon to upload via S3, since the S3 API has better support for uploading large files efficiently.
 * ## Import
 * Using `pulumi import`, import Lambda Layers using `arn`. For example:
 * ```sh
 * $ pulumi import aws:lambda/layerVersion:LayerVersion test_layer arn:aws:lambda:_REGION_:_ACCOUNT_ID_:layer:_LAYER_NAME_:_LAYER_VERSION_
 * ```
 * @property code Path to the function's deployment package within the local filesystem. If defined, The `s3_`-prefixed options cannot be used.
 * @property compatibleArchitectures List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
 * @property compatibleRuntimes List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
 * @property description Description of what your Lambda Layer does.
 * @property layerName Unique name for your Lambda Layer
 * The following arguments are optional:
 * @property licenseInfo License info for your Lambda Layer. See [License Info](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-LicenseInfo).
 * @property s3Bucket S3 bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same AWS region where you are creating the Lambda function.
 * @property s3Key S3 key of an object containing the function's deployment package. Conflicts with `filename`.
 * @property s3ObjectVersion Object version containing the function's deployment package. Conflicts with `filename`.
 * @property skipDestroy Whether to retain the old version of a previously deployed Lambda Layer. Default is `false`. When this is not set to `true`, changing any of `compatible_architectures`, `compatible_runtimes`, `description`, `filename`, `layer_name`, `license_info`, `s3_bucket`, `s3_key`, `s3_object_version`, or `source_code_hash` forces deletion of the existing layer version and creation of a new layer version.
 * @property sourceCodeHash Virtual attribute used to trigger replacement when source code changes. Must be set to a base64-encoded SHA256 hash of the package file specified with either `filename` or `s3_key`.
 */
public data class LayerVersionArgs(
    public val code: Output? = null,
    public val compatibleArchitectures: Output>? = null,
    public val compatibleRuntimes: Output>? = null,
    public val description: Output? = null,
    public val layerName: Output? = null,
    public val licenseInfo: Output? = null,
    public val s3Bucket: Output? = null,
    public val s3Key: Output? = null,
    public val s3ObjectVersion: Output? = null,
    public val skipDestroy: Output? = null,
    public val sourceCodeHash: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.lambda.LayerVersionArgs =
        com.pulumi.aws.lambda.LayerVersionArgs.builder()
            .code(code?.applyValue({ args0 -> args0 }))
            .compatibleArchitectures(
                compatibleArchitectures?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0
                    })
                }),
            )
            .compatibleRuntimes(compatibleRuntimes?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .description(description?.applyValue({ args0 -> args0 }))
            .layerName(layerName?.applyValue({ args0 -> args0 }))
            .licenseInfo(licenseInfo?.applyValue({ args0 -> args0 }))
            .s3Bucket(s3Bucket?.applyValue({ args0 -> args0 }))
            .s3Key(s3Key?.applyValue({ args0 -> args0 }))
            .s3ObjectVersion(s3ObjectVersion?.applyValue({ args0 -> args0 }))
            .skipDestroy(skipDestroy?.applyValue({ args0 -> args0 }))
            .sourceCodeHash(sourceCodeHash?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [LayerVersionArgs].
 */
@PulumiTagMarker
public class LayerVersionArgsBuilder internal constructor() {
    private var code: Output? = null

    private var compatibleArchitectures: Output>? = null

    private var compatibleRuntimes: Output>? = null

    private var description: Output? = null

    private var layerName: Output? = null

    private var licenseInfo: Output? = null

    private var s3Bucket: Output? = null

    private var s3Key: Output? = null

    private var s3ObjectVersion: Output? = null

    private var skipDestroy: Output? = null

    private var sourceCodeHash: Output? = null

    /**
     * @param value Path to the function's deployment package within the local filesystem. If defined, The `s3_`-prefixed options cannot be used.
     */
    @JvmName("xerfqdggwiwkqlgs")
    public suspend fun code(`value`: Output) {
        this.code = value
    }

    /**
     * @param value List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
     */
    @JvmName("vllxdanlcpijhumw")
    public suspend fun compatibleArchitectures(`value`: Output>) {
        this.compatibleArchitectures = value
    }

    @JvmName("jpbdaojbssrekgid")
    public suspend fun compatibleArchitectures(vararg values: Output) {
        this.compatibleArchitectures = Output.all(values.asList())
    }

    /**
     * @param values List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
     */
    @JvmName("nkflallvnnipfami")
    public suspend fun compatibleArchitectures(values: List>) {
        this.compatibleArchitectures = Output.all(values)
    }

    /**
     * @param value List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
     */
    @JvmName("byqwtkhlgqfvfcyx")
    public suspend fun compatibleRuntimes(`value`: Output>) {
        this.compatibleRuntimes = value
    }

    @JvmName("xpcpqcqnwptqvhxl")
    public suspend fun compatibleRuntimes(vararg values: Output) {
        this.compatibleRuntimes = Output.all(values.asList())
    }

    /**
     * @param values List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
     */
    @JvmName("xljyekyijewmoyvb")
    public suspend fun compatibleRuntimes(values: List>) {
        this.compatibleRuntimes = Output.all(values)
    }

    /**
     * @param value Description of what your Lambda Layer does.
     */
    @JvmName("tmmoabspffodeapr")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Unique name for your Lambda Layer
     * The following arguments are optional:
     */
    @JvmName("ptwjxidhjdmsyrji")
    public suspend fun layerName(`value`: Output) {
        this.layerName = value
    }

    /**
     * @param value License info for your Lambda Layer. See [License Info](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-LicenseInfo).
     */
    @JvmName("rlbjhwuqqaucpold")
    public suspend fun licenseInfo(`value`: Output) {
        this.licenseInfo = value
    }

    /**
     * @param value S3 bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same AWS region where you are creating the Lambda function.
     */
    @JvmName("grdbaodpfnavrfdn")
    public suspend fun s3Bucket(`value`: Output) {
        this.s3Bucket = value
    }

    /**
     * @param value S3 key of an object containing the function's deployment package. Conflicts with `filename`.
     */
    @JvmName("lbrttgmkrgkgsgki")
    public suspend fun s3Key(`value`: Output) {
        this.s3Key = value
    }

    /**
     * @param value Object version containing the function's deployment package. Conflicts with `filename`.
     */
    @JvmName("aowsupcyntgyqsuk")
    public suspend fun s3ObjectVersion(`value`: Output) {
        this.s3ObjectVersion = value
    }

    /**
     * @param value Whether to retain the old version of a previously deployed Lambda Layer. Default is `false`. When this is not set to `true`, changing any of `compatible_architectures`, `compatible_runtimes`, `description`, `filename`, `layer_name`, `license_info`, `s3_bucket`, `s3_key`, `s3_object_version`, or `source_code_hash` forces deletion of the existing layer version and creation of a new layer version.
     */
    @JvmName("vhywcqokyvvfibrf")
    public suspend fun skipDestroy(`value`: Output) {
        this.skipDestroy = value
    }

    /**
     * @param value Virtual attribute used to trigger replacement when source code changes. Must be set to a base64-encoded SHA256 hash of the package file specified with either `filename` or `s3_key`.
     */
    @JvmName("vpvicdablcuomqat")
    public suspend fun sourceCodeHash(`value`: Output) {
        this.sourceCodeHash = value
    }

    /**
     * @param value Path to the function's deployment package within the local filesystem. If defined, The `s3_`-prefixed options cannot be used.
     */
    @JvmName("emopghmltiyxmort")
    public suspend fun code(`value`: Archive?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.code = mapped
    }

    /**
     * @param value List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
     */
    @JvmName("swuvlofvaihqopyc")
    public suspend fun compatibleArchitectures(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.compatibleArchitectures = mapped
    }

    /**
     * @param values List of [Architectures](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleArchitectures) this layer is compatible with. Currently `x86_64` and `arm64` can be specified.
     */
    @JvmName("gtymujeavdqyjyxl")
    public suspend fun compatibleArchitectures(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.compatibleArchitectures = mapped
    }

    /**
     * @param value List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
     */
    @JvmName("xwkdhvfnliyapydj")
    public suspend fun compatibleRuntimes(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.compatibleRuntimes = mapped
    }

    /**
     * @param values List of [Runtimes](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-CompatibleRuntimes) this layer is compatible with. Up to 15 runtimes can be specified.
     */
    @JvmName("wphkrqponueiiurg")
    public suspend fun compatibleRuntimes(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.compatibleRuntimes = mapped
    }

    /**
     * @param value Description of what your Lambda Layer does.
     */
    @JvmName("xbhaivvfggihfhcp")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Unique name for your Lambda Layer
     * The following arguments are optional:
     */
    @JvmName("vuqphwafxbxhvlgk")
    public suspend fun layerName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.layerName = mapped
    }

    /**
     * @param value License info for your Lambda Layer. See [License Info](https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html#SSS-PublishLayerVersion-request-LicenseInfo).
     */
    @JvmName("tyoebgkcwrelprqg")
    public suspend fun licenseInfo(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.licenseInfo = mapped
    }

    /**
     * @param value S3 bucket location containing the function's deployment package. Conflicts with `filename`. This bucket must reside in the same AWS region where you are creating the Lambda function.
     */
    @JvmName("xrpssrxqwrpvirvd")
    public suspend fun s3Bucket(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.s3Bucket = mapped
    }

    /**
     * @param value S3 key of an object containing the function's deployment package. Conflicts with `filename`.
     */
    @JvmName("orbgwsgmvhhqcvyq")
    public suspend fun s3Key(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.s3Key = mapped
    }

    /**
     * @param value Object version containing the function's deployment package. Conflicts with `filename`.
     */
    @JvmName("xoceevqlgojfolgq")
    public suspend fun s3ObjectVersion(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.s3ObjectVersion = mapped
    }

    /**
     * @param value Whether to retain the old version of a previously deployed Lambda Layer. Default is `false`. When this is not set to `true`, changing any of `compatible_architectures`, `compatible_runtimes`, `description`, `filename`, `layer_name`, `license_info`, `s3_bucket`, `s3_key`, `s3_object_version`, or `source_code_hash` forces deletion of the existing layer version and creation of a new layer version.
     */
    @JvmName("sreuefwlkyqrujtn")
    public suspend fun skipDestroy(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.skipDestroy = mapped
    }

    /**
     * @param value Virtual attribute used to trigger replacement when source code changes. Must be set to a base64-encoded SHA256 hash of the package file specified with either `filename` or `s3_key`.
     */
    @JvmName("armqfvrphowjqcuj")
    public suspend fun sourceCodeHash(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceCodeHash = mapped
    }

    internal fun build(): LayerVersionArgs = LayerVersionArgs(
        code = code,
        compatibleArchitectures = compatibleArchitectures,
        compatibleRuntimes = compatibleRuntimes,
        description = description,
        layerName = layerName,
        licenseInfo = licenseInfo,
        s3Bucket = s3Bucket,
        s3Key = s3Key,
        s3ObjectVersion = s3ObjectVersion,
        skipDestroy = skipDestroy,
        sourceCodeHash = sourceCodeHash,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy