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

com.pulumi.aws.ec2.kotlin.CapacityReservationArgs.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: 6.57.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.aws.ec2.kotlin

import com.pulumi.aws.ec2.CapacityReservationArgs.builder
import com.pulumi.aws.ec2.kotlin.enums.InstancePlatform
import com.pulumi.aws.ec2.kotlin.enums.InstanceType
import com.pulumi.aws.ec2.kotlin.enums.Tenancy
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides an EC2 Capacity Reservation. This allows you to reserve capacity for your Amazon EC2 instances in a specific Availability Zone for any duration.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as aws from "@pulumi/aws";
 * const _default = new aws.ec2.CapacityReservation("default", {
 *     instanceType: aws.ec2.InstanceType.T2_Micro,
 *     instancePlatform: aws.ec2.InstancePlatform.LinuxUnix,
 *     availabilityZone: "eu-west-1a",
 *     instanceCount: 1,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_aws as aws
 * default = aws.ec2.CapacityReservation("default",
 *     instance_type=aws.ec2.InstanceType.T2_MICRO,
 *     instance_platform=aws.ec2.InstancePlatform.LINUX_UNIX,
 *     availability_zone="eu-west-1a",
 *     instance_count=1)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Aws = Pulumi.Aws;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new Aws.Ec2.CapacityReservation("default", new()
 *     {
 *         InstanceType = Aws.Ec2.InstanceType.T2_Micro,
 *         InstancePlatform = Aws.Ec2.InstancePlatform.LinuxUnix,
 *         AvailabilityZone = "eu-west-1a",
 *         InstanceCount = 1,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := ec2.NewCapacityReservation(ctx, "default", &ec2.CapacityReservationArgs{
 * 			InstanceType:     pulumi.String(ec2.InstanceType_T2_Micro),
 * 			InstancePlatform: pulumi.String(ec2.InstancePlatformLinuxUnix),
 * 			AvailabilityZone: pulumi.String("eu-west-1a"),
 * 			InstanceCount:    pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.aws.ec2.CapacityReservation;
 * import com.pulumi.aws.ec2.CapacityReservationArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 *     public static void stack(Context ctx) {
 *         var default_ = new CapacityReservation("default", CapacityReservationArgs.builder()
 *             .instanceType("t2.micro")
 *             .instancePlatform("Linux/UNIX")
 *             .availabilityZone("eu-west-1a")
 *             .instanceCount(1)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: aws:ec2:CapacityReservation
 *     properties:
 *       instanceType: t2.micro
 *       instancePlatform: Linux/UNIX
 *       availabilityZone: eu-west-1a
 *       instanceCount: 1
 * ```
 * 
 * ## Import
 * Using `pulumi import`, import Capacity Reservations using the `id`. For example:
 * ```sh
 * $ pulumi import aws:ec2/capacityReservation:CapacityReservation web cr-0123456789abcdef0
 * ```
 * @property availabilityZone The Availability Zone in which to create the Capacity Reservation.
 * @property ebsOptimized Indicates whether the Capacity Reservation supports EBS-optimized instances.
 * @property endDate The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
 * @property endDateType Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
 * @property ephemeralStorage Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
 * @property instanceCount The number of instances for which to reserve capacity.
 * @property instanceMatchCriteria Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
 * @property instancePlatform The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
 * @property instanceType The instance type for which to reserve capacity.
 * @property outpostArn The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
 * @property placementGroupArn The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.
 * @property tags A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
 * @property tenancy Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
 */
public data class CapacityReservationArgs(
    public val availabilityZone: Output? = null,
    public val ebsOptimized: Output? = null,
    public val endDate: Output? = null,
    public val endDateType: Output? = null,
    public val ephemeralStorage: Output? = null,
    public val instanceCount: Output? = null,
    public val instanceMatchCriteria: Output? = null,
    public val instancePlatform: Output>? = null,
    public val instanceType: Output>? = null,
    public val outpostArn: Output? = null,
    public val placementGroupArn: Output? = null,
    public val tags: Output>? = null,
    public val tenancy: Output>? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.aws.ec2.CapacityReservationArgs =
        com.pulumi.aws.ec2.CapacityReservationArgs.builder()
            .availabilityZone(availabilityZone?.applyValue({ args0 -> args0 }))
            .ebsOptimized(ebsOptimized?.applyValue({ args0 -> args0 }))
            .endDate(endDate?.applyValue({ args0 -> args0 }))
            .endDateType(endDateType?.applyValue({ args0 -> args0 }))
            .ephemeralStorage(ephemeralStorage?.applyValue({ args0 -> args0 }))
            .instanceCount(instanceCount?.applyValue({ args0 -> args0 }))
            .instanceMatchCriteria(instanceMatchCriteria?.applyValue({ args0 -> args0 }))
            .instancePlatform(
                instancePlatform?.applyValue({ args0 ->
                    args0.transform(
                        { args0 -> args0 },
                        { args0 -> args0.let({ args0 -> args0.toJava() }) },
                    )
                }),
            )
            .instanceType(
                instanceType?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .outpostArn(outpostArn?.applyValue({ args0 -> args0 }))
            .placementGroupArn(placementGroupArn?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .tenancy(
                tenancy?.applyValue({ args0 ->
                    args0.transform({ args0 -> args0 }, { args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            ).build()
}

/**
 * Builder for [CapacityReservationArgs].
 */
@PulumiTagMarker
public class CapacityReservationArgsBuilder internal constructor() {
    private var availabilityZone: Output? = null

    private var ebsOptimized: Output? = null

    private var endDate: Output? = null

    private var endDateType: Output? = null

    private var ephemeralStorage: Output? = null

    private var instanceCount: Output? = null

    private var instanceMatchCriteria: Output? = null

    private var instancePlatform: Output>? = null

    private var instanceType: Output>? = null

    private var outpostArn: Output? = null

    private var placementGroupArn: Output? = null

    private var tags: Output>? = null

    private var tenancy: Output>? = null

    /**
     * @param value The Availability Zone in which to create the Capacity Reservation.
     */
    @JvmName("uybovvgtndrpyywx")
    public suspend fun availabilityZone(`value`: Output) {
        this.availabilityZone = value
    }

    /**
     * @param value Indicates whether the Capacity Reservation supports EBS-optimized instances.
     */
    @JvmName("jtdsoyojgxhibhbn")
    public suspend fun ebsOptimized(`value`: Output) {
        this.ebsOptimized = value
    }

    /**
     * @param value The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
     */
    @JvmName("avjykstortmmrysl")
    public suspend fun endDate(`value`: Output) {
        this.endDate = value
    }

    /**
     * @param value Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
     */
    @JvmName("ihhiksbvtopnqruj")
    public suspend fun endDateType(`value`: Output) {
        this.endDateType = value
    }

    /**
     * @param value Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
     */
    @JvmName("mpqirakmgjepbkxm")
    public suspend fun ephemeralStorage(`value`: Output) {
        this.ephemeralStorage = value
    }

    /**
     * @param value The number of instances for which to reserve capacity.
     */
    @JvmName("rubdqfigaaertvwq")
    public suspend fun instanceCount(`value`: Output) {
        this.instanceCount = value
    }

    /**
     * @param value Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
     */
    @JvmName("kxcfeomakfobcjnp")
    public suspend fun instanceMatchCriteria(`value`: Output) {
        this.instanceMatchCriteria = value
    }

    /**
     * @param value The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
     */
    @JvmName("oxbpnlmjyknwcsql")
    public suspend fun instancePlatform(`value`: Output>) {
        this.instancePlatform = value
    }

    /**
     * @param value The instance type for which to reserve capacity.
     */
    @JvmName("yitehfisuouysiro")
    public suspend fun instanceType(`value`: Output>) {
        this.instanceType = value
    }

    /**
     * @param value The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
     */
    @JvmName("jwmgyxsppxiekoua")
    public suspend fun outpostArn(`value`: Output) {
        this.outpostArn = value
    }

    /**
     * @param value The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.
     */
    @JvmName("avnrwvtuypkgasgt")
    public suspend fun placementGroupArn(`value`: Output) {
        this.placementGroupArn = value
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("uvnjknfxtpdjtbcq")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
     */
    @JvmName("ylpgpslcgysaekhr")
    public suspend fun tenancy(`value`: Output>) {
        this.tenancy = value
    }

    /**
     * @param value The Availability Zone in which to create the Capacity Reservation.
     */
    @JvmName("btvufcdsbtjcyxlh")
    public suspend fun availabilityZone(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.availabilityZone = mapped
    }

    /**
     * @param value Indicates whether the Capacity Reservation supports EBS-optimized instances.
     */
    @JvmName("njhrftpgoqcraney")
    public suspend fun ebsOptimized(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ebsOptimized = mapped
    }

    /**
     * @param value The date and time at which the Capacity Reservation expires. When a Capacity Reservation expires, the reserved capacity is released and you can no longer launch instances into it. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
     */
    @JvmName("nkyqamiudvphqdeo")
    public suspend fun endDate(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.endDate = mapped
    }

    /**
     * @param value Indicates the way in which the Capacity Reservation ends. Specify either `unlimited` or `limited`.
     */
    @JvmName("ksshwgdyrgronshu")
    public suspend fun endDateType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.endDateType = mapped
    }

    /**
     * @param value Indicates whether the Capacity Reservation supports instances with temporary, block-level storage.
     */
    @JvmName("enlhdivurirmopmc")
    public suspend fun ephemeralStorage(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.ephemeralStorage = mapped
    }

    /**
     * @param value The number of instances for which to reserve capacity.
     */
    @JvmName("yiwuuefjsxkujoes")
    public suspend fun instanceCount(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instanceCount = mapped
    }

    /**
     * @param value Indicates the type of instance launches that the Capacity Reservation accepts. Specify either `open` or `targeted`.
     */
    @JvmName("bfyatpdwktjxfsgv")
    public suspend fun instanceMatchCriteria(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instanceMatchCriteria = mapped
    }

    /**
     * @param value The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
     */
    @JvmName("ahtmxhsoockpoftf")
    public suspend fun instancePlatform(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instancePlatform = mapped
    }

    /**
     * @param value The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
     */
    @JvmName("xswblofvvsdutcur")
    public fun instancePlatform(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.instancePlatform = mapped
    }

    /**
     * @param value The type of operating system for which to reserve capacity. Valid options are `Linux/UNIX`, `Red Hat Enterprise Linux`, `SUSE Linux`, `Windows`, `Windows with SQL Server`, `Windows with SQL Server Enterprise`, `Windows with SQL Server Standard` or `Windows with SQL Server Web`.
     */
    @JvmName("pehhdmlcpcnoltxu")
    public fun instancePlatform(`value`: InstancePlatform) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.instancePlatform = mapped
    }

    /**
     * @param value The instance type for which to reserve capacity.
     */
    @JvmName("ylrcddnwcarnostk")
    public suspend fun instanceType(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.instanceType = mapped
    }

    /**
     * @param value The instance type for which to reserve capacity.
     */
    @JvmName("ampsejgwhhxhqlsj")
    public fun instanceType(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.instanceType = mapped
    }

    /**
     * @param value The instance type for which to reserve capacity.
     */
    @JvmName("dcshnlgcnxtcfcnb")
    public fun instanceType(`value`: InstanceType) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.instanceType = mapped
    }

    /**
     * @param value The Amazon Resource Name (ARN) of the Outpost on which to create the Capacity Reservation.
     */
    @JvmName("gthgjxaehlorgnkv")
    public suspend fun outpostArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.outpostArn = mapped
    }

    /**
     * @param value The Amazon Resource Name (ARN) of the cluster placement group in which to create the Capacity Reservation.
     */
    @JvmName("ogoemfxlfmooiilu")
    public suspend fun placementGroupArn(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.placementGroupArn = mapped
    }

    /**
     * @param value A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("xirccidxjwgxpwua")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A map of tags to assign to the resource. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
     */
    @JvmName("daxjibnaspfahwxa")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
     */
    @JvmName("tcrxmjdptlmuoxwh")
    public suspend fun tenancy(`value`: Either?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tenancy = mapped
    }

    /**
     * @param value Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
     */
    @JvmName("pctlcwvvrxotsbcp")
    public fun tenancy(`value`: String) {
        val toBeMapped = Either.ofLeft(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tenancy = mapped
    }

    /**
     * @param value Indicates the tenancy of the Capacity Reservation. Specify either `default` or `dedicated`.
     */
    @JvmName("pikjecclqvfrlupw")
    public fun tenancy(`value`: Tenancy) {
        val toBeMapped = Either.ofRight(value)
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tenancy = mapped
    }

    internal fun build(): CapacityReservationArgs = CapacityReservationArgs(
        availabilityZone = availabilityZone,
        ebsOptimized = ebsOptimized,
        endDate = endDate,
        endDateType = endDateType,
        ephemeralStorage = ephemeralStorage,
        instanceCount = instanceCount,
        instanceMatchCriteria = instanceMatchCriteria,
        instancePlatform = instancePlatform,
        instanceType = instanceType,
        outpostArn = outpostArn,
        placementGroupArn = placementGroupArn,
        tags = tags,
        tenancy = tenancy,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy