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

com.pulumi.awsnative.ec2.kotlin.Ec2Fleet.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.ec2.kotlin.enums.Ec2FleetExcessCapacityTerminationPolicy
import com.pulumi.awsnative.ec2.kotlin.enums.Ec2FleetType
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetFleetLaunchTemplateConfigRequest
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetOnDemandOptionsRequest
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetSpotOptionsRequest
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetTagSpecification
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetTargetCapacitySpecificationRequest
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.enums.Ec2FleetExcessCapacityTerminationPolicy.Companion.toKotlin as ec2FleetExcessCapacityTerminationPolicyToKotlin
import com.pulumi.awsnative.ec2.kotlin.enums.Ec2FleetType.Companion.toKotlin as ec2FleetTypeToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetFleetLaunchTemplateConfigRequest.Companion.toKotlin as ec2FleetFleetLaunchTemplateConfigRequestToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetOnDemandOptionsRequest.Companion.toKotlin as ec2FleetOnDemandOptionsRequestToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetSpotOptionsRequest.Companion.toKotlin as ec2FleetSpotOptionsRequestToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetTagSpecification.Companion.toKotlin as ec2FleetTagSpecificationToKotlin
import com.pulumi.awsnative.ec2.kotlin.outputs.Ec2FleetTargetCapacitySpecificationRequest.Companion.toKotlin as ec2FleetTargetCapacitySpecificationRequestToKotlin

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

    public var args: Ec2FleetArgs = Ec2FleetArgs()

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

/**
 * Resource Type definition for AWS::EC2::EC2Fleet
 */
public class Ec2Fleet internal constructor(
    override val javaResource: com.pulumi.awsnative.ec2.Ec2Fleet,
) : KotlinCustomResource(javaResource, Ec2FleetMapper) {
    /**
     * Reserved.
     */
    public val context: Output?
        get() = javaResource.context().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Indicates whether running instances should be terminated if the total target capacity of the EC2 Fleet is decreased below the current size of the EC2 Fleet.
     * Supported only for fleets of type `maintain` .
     */
    public val excessCapacityTerminationPolicy: Output?
        get() = javaResource.excessCapacityTerminationPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ec2FleetExcessCapacityTerminationPolicyToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The ID of the EC2 Fleet.
     */
    public val fleetId: Output
        get() = javaResource.fleetId().applyValue({ args0 -> args0 })

    /**
     * The configuration for the EC2 Fleet.
     */
    public val launchTemplateConfigs: Output>
        get() = javaResource.launchTemplateConfigs().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> ec2FleetFleetLaunchTemplateConfigRequestToKotlin(args0) })
            })
        })

    /**
     * Describes the configuration of On-Demand Instances in an EC2 Fleet.
     */
    public val onDemandOptions: Output?
        get() = javaResource.onDemandOptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> ec2FleetOnDemandOptionsRequestToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * Indicates whether EC2 Fleet should replace unhealthy Spot Instances. Supported only for fleets of type `maintain` . For more information, see [EC2 Fleet health checks](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/manage-ec2-fleet.html#ec2-fleet-health-checks) in the *Amazon EC2 User Guide* .
     */
    public val replaceUnhealthyInstances: Output?
        get() = javaResource.replaceUnhealthyInstances().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Describes the configuration of Spot Instances in an EC2 Fleet.
     */
    public val spotOptions: Output?
        get() = javaResource.spotOptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ec2FleetSpotOptionsRequestToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The key-value pair for tagging the EC2 Fleet request on creation. For more information, see [Tag your resources](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html#tag-resources) .
     * If the fleet type is `instant` , specify a resource type of `fleet` to tag the fleet or `instance` to tag the instances at launch.
     * If the fleet type is `maintain` or `request` , specify a resource type of `fleet` to tag the fleet. You cannot specify a resource type of `instance` . To tag instances at launch, specify the tags in a [launch template](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html#create-launch-template) .
     */
    public val tagSpecifications: Output>?
        get() = javaResource.tagSpecifications().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 ->
                        ec2FleetTagSpecificationToKotlin(args0)
                    })
                })
            }).orElse(null)
        })

    /**
     * The number of units to request.
     */
    public val targetCapacitySpecification: Output
        get() = javaResource.targetCapacitySpecification().applyValue({ args0 ->
            args0.let({ args0 ->
                ec2FleetTargetCapacitySpecificationRequestToKotlin(args0)
            })
        })

    /**
     * Indicates whether running instances should be terminated when the EC2 Fleet expires.
     */
    public val terminateInstancesWithExpiration: Output?
        get() = javaResource.terminateInstancesWithExpiration().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The fleet type. The default value is `maintain` .
     * - `maintain` - The EC2 Fleet places an asynchronous request for your desired capacity, and continues to maintain your desired Spot capacity by replenishing interrupted Spot Instances.
     * - `request` - The EC2 Fleet places an asynchronous one-time request for your desired capacity, but does submit Spot requests in alternative capacity pools if Spot capacity is unavailable, and does not maintain Spot capacity if Spot Instances are interrupted.
     * - `instant` - The EC2 Fleet places a synchronous one-time request for your desired capacity, and returns errors for any instances that could not be launched.
     * For more information, see [EC2 Fleet request types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-request-type.html) in the *Amazon EC2 User Guide* .
     */
    public val type: Output?
        get() = javaResource.type().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    ec2FleetTypeToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * The start date and time of the request, in UTC format (for example, *YYYY* - *MM* - *DD* T *HH* : *MM* : *SS* Z). The default is to start fulfilling the request immediately.
     */
    public val validFrom: Output?
        get() = javaResource.validFrom().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The end date and time of the request, in UTC format (for example, *YYYY* - *MM* - *DD* T *HH* : *MM* : *SS* Z). At this point, no new EC2 Fleet requests are placed or able to fulfill the request. If no value is specified, the request remains until you cancel it.
     */
    public val validUntil: Output?
        get() = javaResource.validUntil().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy