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

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

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

package com.pulumi.awsnative.iot.kotlin

import com.pulumi.awsnative.iot.kotlin.outputs.ThingAttributePayload
import com.pulumi.awsnative.iot.kotlin.outputs.ThingAttributePayload.Companion.toKotlin
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

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

    public var args: ThingArgs = ThingArgs()

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

/**
 * Resource Type definition for AWS::IoT::Thing
 * ## Example Usage
 * ### Example
 * No Java example available.
 */
public class Thing internal constructor(
    override val javaResource: com.pulumi.awsnative.iot.Thing,
) : KotlinCustomResource(javaResource, ThingMapper) {
    /**
     * The Amazon Resource Name (ARN) of the AWS IoT thing, such as `arn:aws:iot:us-east-2:123456789012:thing/MyThing` .
     */
    public val arn: Output
        get() = javaResource.arn().applyValue({ args0 -> args0 })

    /**
     * A string that contains up to three key value pairs. Maximum length of 800. Duplicates not allowed.
     */
    public val attributePayload: Output?
        get() = javaResource.attributePayload().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> toKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The Id of this thing.
     */
    public val awsId: Output
        get() = javaResource.awsId().applyValue({ args0 -> args0 })

    /**
     * The name of the thing to update.
     * You can't change a thing's name. To change a thing's name, you must create a new thing, give it the new name, and then delete the old thing.
     */
    public val thingName: Output?
        get() = javaResource.thingName().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy