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

com.pulumi.awsnative.ec2.kotlin.LaunchTemplate.kt Maven / Gradle / Ivy

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

package com.pulumi.awsnative.ec2.kotlin

import com.pulumi.awsnative.ec2.kotlin.outputs.LaunchTemplateData
import com.pulumi.awsnative.ec2.kotlin.outputs.LaunchTemplateTagSpecification
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.ec2.kotlin.outputs.LaunchTemplateData.Companion.toKotlin as launchTemplateDataToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.LaunchTemplateTagSpecification.Companion.toKotlin as launchTemplateTagSpecificationToKotlin

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

    public var args: LaunchTemplateArgs = LaunchTemplateArgs()

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

/**
 * Specifies the properties for creating a launch template.
 *  The minimum required properties for specifying a launch template are as follows:
 *   +  You must specify at least one property for the launch template data.
 *   +  You can optionally specify a name for the launch template. If you do not specify a name, CFN creates a name for you.
 *  A launch template can contain some or all of the configuration information to launch an instance. When you launch an instance using a launch template, instance properties that are not specified in the launch template use default values, except the ``ImageId`` property, which has no default value. If you do not specify an AMI ID for the launch template ``ImageId`` property, you must specify an AMI ID for the instance ``ImageId`` property.
 *  For more information, see [Launch an instance from a launch template](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html) in the *Amazon EC2 User Guide*.
 */
public class LaunchTemplate internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.LaunchTemplate,
) : KotlinCustomResource(javaResource, LaunchTemplateMapper) {
    /**
     * The default version of the launch template, such as 2.
     * The default version of a launch template cannot be specified in AWS CloudFormation . The default version can be set in the Amazon EC2 console or by using the `modify-launch-template` AWS CLI command.
     */
    public val defaultVersionNumber: Output
        get() = javaResource.defaultVersionNumber().applyValue({ args0 -> args0 })

    /**
     * The latest version of the launch template, such as `5` .
     */
    public val latestVersionNumber: Output
        get() = javaResource.latestVersionNumber().applyValue({ args0 -> args0 })

    /**
     * The information for the launch template.
     */
    public val launchTemplateData: Output
        get() = javaResource.launchTemplateData().applyValue({ args0 ->
            args0.let({ args0 ->
                launchTemplateDataToKotlin(args0)
            })
        })

    /**
     * The ID of the launch template.
     */
    public val launchTemplateId: Output
        get() = javaResource.launchTemplateId().applyValue({ args0 -> args0 })

    /**
     * A name for the launch template.
     */
    public val launchTemplateName: Output?
        get() = javaResource.launchTemplateName().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The tags to apply to the launch template on creation. To tag the launch template, the resource type must be ``launch-template``.
     *  To specify the tags for the resources that are created when an instance is launched, you must use [TagSpecifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-tagspecifications).
     */
    public val tagSpecifications: Output>?
        get() = javaResource.tagSpecifications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        launchTemplateTagSpecificationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * A description for the first version of the launch template.
     */
    public val versionDescription: Output?
        get() = javaResource.versionDescription().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

public object LaunchTemplateMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.awsnative.ec2.LaunchTemplate::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy