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

com.pulumi.aws.cloudfront.kotlin.FunctionArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.cloudfront.kotlin

import com.pulumi.aws.cloudfront.FunctionArgs.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 CloudFront Function resource. With CloudFront Functions in Amazon CloudFront, you can write lightweight functions in JavaScript for high-scale, latency-sensitive CDN customizations.
 * See [CloudFront Functions](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/cloudfront-functions.html)
 * > **NOTE:** You cannot delete a function if it’s associated with a cache behavior. First, update your distributions to remove the function association from all cache behaviors, then delete the function.
 * ## Example Usage
 * ## Import
 * Using `pulumi import`, import CloudFront Functions using the `name`. For example:
 * ```sh
 * $ pulumi import aws:cloudfront/function:Function test my_test_function
 * ```
 * @property code Source code of the function
 * @property comment Comment.
 * @property keyValueStoreAssociations List of `aws.cloudfront.KeyValueStore` ARNs to be associated to the function. AWS limits associations to on key value store per function.
 * @property name Unique name for your CloudFront Function.
 * @property publish Whether to publish creation/change as Live CloudFront Function Version. Defaults to `true`.
 * @property runtime Identifier of the function's runtime. Valid values are `cloudfront-js-1.0` and `cloudfront-js-2.0`.
 * The following arguments are optional:
 */
public data class FunctionArgs(
    public val code: Output? = null,
    public val comment: Output? = null,
    public val keyValueStoreAssociations: Output>? = null,
    public val name: Output? = null,
    public val publish: Output? = null,
    public val runtime: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.cloudfront.FunctionArgs =
        com.pulumi.aws.cloudfront.FunctionArgs.builder()
            .code(code?.applyValue({ args0 -> args0 }))
            .comment(comment?.applyValue({ args0 -> args0 }))
            .keyValueStoreAssociations(
                keyValueStoreAssociations?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0
                    })
                }),
            )
            .name(name?.applyValue({ args0 -> args0 }))
            .publish(publish?.applyValue({ args0 -> args0 }))
            .runtime(runtime?.applyValue({ args0 -> args0 })).build()
}

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

    private var comment: Output? = null

    private var keyValueStoreAssociations: Output>? = null

    private var name: Output? = null

    private var publish: Output? = null

    private var runtime: Output? = null

    /**
     * @param value Source code of the function
     */
    @JvmName("mqglaseedrsmiymj")
    public suspend fun code(`value`: Output) {
        this.code = value
    }

    /**
     * @param value Comment.
     */
    @JvmName("obiwukbtbpdwukjj")
    public suspend fun comment(`value`: Output) {
        this.comment = value
    }

    /**
     * @param value List of `aws.cloudfront.KeyValueStore` ARNs to be associated to the function. AWS limits associations to on key value store per function.
     */
    @JvmName("uuaahqfyvlruhili")
    public suspend fun keyValueStoreAssociations(`value`: Output>) {
        this.keyValueStoreAssociations = value
    }

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

    /**
     * @param values List of `aws.cloudfront.KeyValueStore` ARNs to be associated to the function. AWS limits associations to on key value store per function.
     */
    @JvmName("opkfnkshcfepirwl")
    public suspend fun keyValueStoreAssociations(values: List>) {
        this.keyValueStoreAssociations = Output.all(values)
    }

    /**
     * @param value Unique name for your CloudFront Function.
     */
    @JvmName("pmmwopahsubgttpf")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value Whether to publish creation/change as Live CloudFront Function Version. Defaults to `true`.
     */
    @JvmName("mqiskcqkrjkehdfo")
    public suspend fun publish(`value`: Output) {
        this.publish = value
    }

    /**
     * @param value Identifier of the function's runtime. Valid values are `cloudfront-js-1.0` and `cloudfront-js-2.0`.
     * The following arguments are optional:
     */
    @JvmName("arnrwwacnihavhxm")
    public suspend fun runtime(`value`: Output) {
        this.runtime = value
    }

    /**
     * @param value Source code of the function
     */
    @JvmName("vvqyrvmquxkrvtmv")
    public suspend fun code(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.code = mapped
    }

    /**
     * @param value Comment.
     */
    @JvmName("focymmocwydjrsds")
    public suspend fun comment(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.comment = mapped
    }

    /**
     * @param value List of `aws.cloudfront.KeyValueStore` ARNs to be associated to the function. AWS limits associations to on key value store per function.
     */
    @JvmName("ocvklikvnxynwewg")
    public suspend fun keyValueStoreAssociations(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.keyValueStoreAssociations = mapped
    }

    /**
     * @param values List of `aws.cloudfront.KeyValueStore` ARNs to be associated to the function. AWS limits associations to on key value store per function.
     */
    @JvmName("pxinwtoowcsfrrsh")
    public suspend fun keyValueStoreAssociations(vararg values: String) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.keyValueStoreAssociations = mapped
    }

    /**
     * @param value Unique name for your CloudFront Function.
     */
    @JvmName("eiaqjhsgnphphufi")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value Whether to publish creation/change as Live CloudFront Function Version. Defaults to `true`.
     */
    @JvmName("mryxucbpvtybipcw")
    public suspend fun publish(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.publish = mapped
    }

    /**
     * @param value Identifier of the function's runtime. Valid values are `cloudfront-js-1.0` and `cloudfront-js-2.0`.
     * The following arguments are optional:
     */
    @JvmName("fdnwwixvrxcfhpuo")
    public suspend fun runtime(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.runtime = mapped
    }

    internal fun build(): FunctionArgs = FunctionArgs(
        code = code,
        comment = comment,
        keyValueStoreAssociations = keyValueStoreAssociations,
        name = name,
        publish = publish,
        runtime = runtime,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy