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

com.pulumi.awsnative.iot.kotlin.Authorizer.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.iot.kotlin

import com.pulumi.awsnative.iot.kotlin.enums.AuthorizerStatus
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 kotlin.collections.Map
import com.pulumi.awsnative.iot.kotlin.enums.AuthorizerStatus.Companion.toKotlin as authorizerStatusToKotlin
import com.pulumi.awsnative.kotlin.outputs.Tag.Companion.toKotlin as tagToKotlin

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

    public var args: AuthorizerArgs = AuthorizerArgs()

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

/**
 * Creates an authorizer.
 */
public class Authorizer internal constructor(
    override val javaResource: com.pulumi.awsnative.iot.Authorizer,
) : KotlinCustomResource(javaResource, AuthorizerMapper) {
    /**
     * The Amazon Resource Name (ARN) of the authorizer.
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * The authorizer's Lambda function ARN.
     */
    public val authorizerFunctionArn: Output
        get() = javaResource.authorizerFunctionArn().applyValue({ args0 -> args0 })

    /**
     * The authorizer name.
     */
    public val authorizerName: Output?
        get() = javaResource.authorizerName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * When `true` , the result from the authorizer's Lambda function is cached for clients that use persistent HTTP connections. The results are cached for the time specified by the Lambda function in `refreshAfterInSeconds` . This value doesn't affect authorization of clients that use MQTT connections.
     */
    public val enableCachingForHttp: Output?
        get() = javaResource.enableCachingForHttp().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies whether AWS IoT validates the token signature in an authorization request.
     */
    public val signingDisabled: Output?
        get() = javaResource.signingDisabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The status of the authorizer.
     * Valid values: `ACTIVE` | `INACTIVE`
     */
    public val status: Output?
        get() = javaResource.status().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    authorizerStatusToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Metadata which can be used to manage the custom authorizer.
     * > For URI Request parameters use format: ...key1=value1&key2=value2...
     * >
     * > For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."
     * >
     * > For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> tagToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * The key used to extract the token from the HTTP headers.
     */
    public val tokenKeyName: Output?
        get() = javaResource.tokenKeyName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The public keys used to validate the token signature returned by your custom authentication service.
     */
    public val tokenSigningPublicKeys: Output>?
        get() = javaResource.tokenSigningPublicKeys().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0.key.to(args0.value) }).toMap()
            }).orElse(null)
        })
}

public object AuthorizerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.iot.Authorizer::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy