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

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

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 1.11.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.awsnative.ec2.kotlin

import com.pulumi.awsnative.kotlin.outputs.CreateOnlyTag
import com.pulumi.awsnative.kotlin.outputs.CreateOnlyTag.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: PlacementGroupArgs = PlacementGroupArgs()

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

/**
 * Resource Type definition for AWS::EC2::PlacementGroup
 */
public class PlacementGroup internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.PlacementGroup,
) : KotlinCustomResource(javaResource, PlacementGroupMapper) {
    /**
     * The Group Name of Placement Group.
     */
    public val groupName: Output
        get() = javaResource.groupName().applyValue({ args0 -> args0 })

    /**
     * The number of partitions. Valid only when **Strategy** is set to `partition`
     */
    public val partitionCount: Output?
        get() = javaResource.partitionCount().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The Spread Level of Placement Group is an enum where it accepts either host or rack when strategy is spread
     */
    public val spreadLevel: Output?
        get() = javaResource.spreadLevel().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * An array of key-value pairs to apply to this resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> toKotlin(args0) })
                })
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy