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

com.pulumi.awsnative.lambda.kotlin.Url.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.lambda.kotlin

import com.pulumi.awsnative.lambda.kotlin.enums.UrlAuthType
import com.pulumi.awsnative.lambda.kotlin.enums.UrlInvokeMode
import com.pulumi.awsnative.lambda.kotlin.outputs.UrlCors
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 com.pulumi.awsnative.lambda.kotlin.enums.UrlAuthType.Companion.toKotlin as urlAuthTypeToKotlin
import com.pulumi.awsnative.lambda.kotlin.enums.UrlInvokeMode.Companion.toKotlin as urlInvokeModeToKotlin
import com.pulumi.awsnative.lambda.kotlin.outputs.UrlCors.Companion.toKotlin as urlCorsToKotlin

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

    public var args: UrlArgs = UrlArgs()

    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 UrlArgsBuilder.() -> Unit) {
        val builder = UrlArgsBuilder()
        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(): Url {
        val builtJavaResource = com.pulumi.awsnative.lambda.Url(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Url(builtJavaResource)
    }
}

/**
 * Resource Type definition for AWS::Lambda::Url
 */
public class Url internal constructor(
    override val javaResource: com.pulumi.awsnative.lambda.Url,
) : KotlinCustomResource(javaResource, UrlMapper) {
    /**
     * Can be either AWS_IAM if the requests are authorized via IAM, or NONE if no authorization is configured on the Function URL.
     */
    public val authType: Output
        get() = javaResource.authType().applyValue({ args0 ->
            args0.let({ args0 ->
                urlAuthTypeToKotlin(args0)
            })
        })

    /**
     * The [Cross-Origin Resource Sharing (CORS)](https://docs.aws.amazon.com/https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) settings for your function URL.
     */
    public val cors: Output?
        get() = javaResource.cors().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    urlCorsToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The full Amazon Resource Name (ARN) of the function associated with the Function URL.
     */
    public val functionArn: Output
        get() = javaResource.functionArn().applyValue({ args0 -> args0 })

    /**
     * The generated url for this resource.
     */
    public val functionUrl: Output
        get() = javaResource.functionUrl().applyValue({ args0 -> args0 })

    /**
     * The invocation mode for the function's URL. Set to BUFFERED if you want to buffer responses before returning them to the client. Set to RESPONSE_STREAM if you want to stream responses, allowing faster time to first byte and larger response payload sizes. If not set, defaults to BUFFERED.
     */
    public val invokeMode: Output?
        get() = javaResource.invokeMode().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    urlInvokeModeToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The alias qualifier for the target function. If TargetFunctionArn is unqualified then Qualifier must be passed.
     */
    public val qualifier: Output?
        get() = javaResource.qualifier().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The Amazon Resource Name (ARN) of the function associated with the Function URL.
     */
    public val targetFunctionArn: Output
        get() = javaResource.targetFunctionArn().applyValue({ args0 -> args0 })
}

public object UrlMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.lambda.Url::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy