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

com.pulumi.awsnative.cloudfront.kotlin.Distribution.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.cloudfront.kotlin

import com.pulumi.awsnative.cloudfront.kotlin.outputs.DistributionConfig
import com.pulumi.awsnative.kotlin.outputs.Tag
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import com.pulumi.awsnative.cloudfront.kotlin.outputs.DistributionConfig.Companion.toKotlin as distributionConfigToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

/**
 * Builder for [Distribution].
 */
@PulumiTagMarker
public class DistributionResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: DistributionArgs = DistributionArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend DistributionArgsBuilder.() -> Unit) {
        val builder = DistributionArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): Distribution {
        val builtJavaResource = com.pulumi.awsnative.cloudfront.Distribution(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Distribution(builtJavaResource)
    }
}

/**
 * A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.
 */
public class Distribution internal constructor(
    override val javaResource: com.pulumi.awsnative.cloudfront.Distribution,
) : KotlinCustomResource(javaResource, DistributionMapper) {
    /**
     * The distribution's identifier. For example: `E1U5RQF7T870K0` .
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * The distribution's configuration.
     */
    public val distributionConfig: Output
        get() = javaResource.distributionConfig().applyValue({ args0 ->
            args0.let({ args0 ->
                distributionConfigToKotlin(args0)
            })
        })

    /**
     * The domain name of the resource, such as `d111111abcdef8.cloudfront.net` .
     */
    public val domainName: Output
        get() = javaResource.domainName().applyValue({ args0 -> args0 })

    /**
     * A complex type that contains zero or more ``Tag`` elements.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object DistributionMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.cloudfront.Distribution::class == javaResource::class

    override fun map(javaResource: Resource): Distribution = Distribution(
        javaResource as
            com.pulumi.awsnative.cloudfront.Distribution,
    )
}

/**
 * @see [Distribution].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Distribution].
 */
public suspend fun distribution(
    name: String,
    block: suspend DistributionResourceBuilder.() -> Unit,
): Distribution {
    val builder = DistributionResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Distribution].
 * @param name The _unique_ name of the resulting resource.
 */
public fun distribution(name: String): Distribution {
    val builder = DistributionResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy