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

com.pulumi.azure.compute.kotlin.CapacityReservationArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.compute.kotlin

import com.pulumi.azure.compute.CapacityReservationArgs.builder
import com.pulumi.azure.compute.kotlin.inputs.CapacityReservationSkuArgs
import com.pulumi.azure.compute.kotlin.inputs.CapacityReservationSkuArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Capacity Reservation within a Capacity Reservation Group.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-rg",
 *     location: "West Europe",
 * });
 * const exampleCapacityReservationGroup = new azure.compute.CapacityReservationGroup("example", {
 *     name: "example-capacity-reservation-group",
 *     resourceGroupName: example.name,
 *     location: example.location,
 * });
 * const exampleCapacityReservation = new azure.compute.CapacityReservation("example", {
 *     name: "example-capacity-reservation",
 *     capacityReservationGroupId: exampleCapacityReservationGroup.id,
 *     sku: {
 *         name: "Standard_D2s_v3",
 *         capacity: 1,
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-rg",
 *     location="West Europe")
 * example_capacity_reservation_group = azure.compute.CapacityReservationGroup("example",
 *     name="example-capacity-reservation-group",
 *     resource_group_name=example.name,
 *     location=example.location)
 * example_capacity_reservation = azure.compute.CapacityReservation("example",
 *     name="example-capacity-reservation",
 *     capacity_reservation_group_id=example_capacity_reservation_group.id,
 *     sku=azure.compute.CapacityReservationSkuArgs(
 *         name="Standard_D2s_v3",
 *         capacity=1,
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-rg",
 *         Location = "West Europe",
 *     });
 *     var exampleCapacityReservationGroup = new Azure.Compute.CapacityReservationGroup("example", new()
 *     {
 *         Name = "example-capacity-reservation-group",
 *         ResourceGroupName = example.Name,
 *         Location = example.Location,
 *     });
 *     var exampleCapacityReservation = new Azure.Compute.CapacityReservation("example", new()
 *     {
 *         Name = "example-capacity-reservation",
 *         CapacityReservationGroupId = exampleCapacityReservationGroup.Id,
 *         Sku = new Azure.Compute.Inputs.CapacityReservationSkuArgs
 *         {
 *             Name = "Standard_D2s_v3",
 *             Capacity = 1,
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-rg"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleCapacityReservationGroup, err := compute.NewCapacityReservationGroup(ctx, "example", &compute.CapacityReservationGroupArgs{
 * 			Name:              pulumi.String("example-capacity-reservation-group"),
 * 			ResourceGroupName: example.Name,
 * 			Location:          example.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewCapacityReservation(ctx, "example", &compute.CapacityReservationArgs{
 * 			Name:                       pulumi.String("example-capacity-reservation"),
 * 			CapacityReservationGroupId: exampleCapacityReservationGroup.ID(),
 * 			Sku: &compute.CapacityReservationSkuArgs{
 * 				Name:     pulumi.String("Standard_D2s_v3"),
 * 				Capacity: 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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.compute.CapacityReservationGroup;
 * import com.pulumi.azure.compute.CapacityReservationGroupArgs;
 * import com.pulumi.azure.compute.CapacityReservation;
 * import com.pulumi.azure.compute.CapacityReservationArgs;
 * import com.pulumi.azure.compute.inputs.CapacityReservationSkuArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-rg")
 *             .location("West Europe")
 *             .build());
 *         var exampleCapacityReservationGroup = new CapacityReservationGroup("exampleCapacityReservationGroup", CapacityReservationGroupArgs.builder()
 *             .name("example-capacity-reservation-group")
 *             .resourceGroupName(example.name())
 *             .location(example.location())
 *             .build());
 *         var exampleCapacityReservation = new CapacityReservation("exampleCapacityReservation", CapacityReservationArgs.builder()
 *             .name("example-capacity-reservation")
 *             .capacityReservationGroupId(exampleCapacityReservationGroup.id())
 *             .sku(CapacityReservationSkuArgs.builder()
 *                 .name("Standard_D2s_v3")
 *                 .capacity(1)
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-rg
 *       location: West Europe
 *   exampleCapacityReservationGroup:
 *     type: azure:compute:CapacityReservationGroup
 *     name: example
 *     properties:
 *       name: example-capacity-reservation-group
 *       resourceGroupName: ${example.name}
 *       location: ${example.location}
 *   exampleCapacityReservation:
 *     type: azure:compute:CapacityReservation
 *     name: example
 *     properties:
 *       name: example-capacity-reservation
 *       capacityReservationGroupId: ${exampleCapacityReservationGroup.id}
 *       sku:
 *         name: Standard_D2s_v3
 *         capacity: 1
 * ```
 * 
 * ## Import
 * Capacity Reservations can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:compute/capacityReservation:CapacityReservation example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroup1/capacityReservations/capacityReservation1
 * ```
 * @property capacityReservationGroupId The ID of the Capacity Reservation Group where the Capacity Reservation exists. Changing this forces a new resource to be created.
 * @property name Specifies the name of this Capacity Reservation. Changing this forces a new resource to be created.
 * @property sku A `sku` block as defined below.
 * @property tags A mapping of tags to assign to the resource.
 * @property zone Specifies the Availability Zone for this Capacity Reservation. Changing this forces a new resource to be created.
 */
public data class CapacityReservationArgs(
    public val capacityReservationGroupId: Output? = null,
    public val name: Output? = null,
    public val sku: Output? = null,
    public val tags: Output>? = null,
    public val zone: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.compute.CapacityReservationArgs =
        com.pulumi.azure.compute.CapacityReservationArgs.builder()
            .capacityReservationGroupId(capacityReservationGroupId?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .sku(sku?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .zone(zone?.applyValue({ args0 -> args0 })).build()
}

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

    private var name: Output? = null

    private var sku: Output? = null

    private var tags: Output>? = null

    private var zone: Output? = null

    /**
     * @param value The ID of the Capacity Reservation Group where the Capacity Reservation exists. Changing this forces a new resource to be created.
     */
    @JvmName("bprfrhgycdkhbskb")
    public suspend fun capacityReservationGroupId(`value`: Output) {
        this.capacityReservationGroupId = value
    }

    /**
     * @param value Specifies the name of this Capacity Reservation. Changing this forces a new resource to be created.
     */
    @JvmName("shfjddlnnsokmwxi")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value A `sku` block as defined below.
     */
    @JvmName("ltnvgswrwfdsqmmc")
    public suspend fun sku(`value`: Output) {
        this.sku = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("ndptaffblmfhwyut")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Specifies the Availability Zone for this Capacity Reservation. Changing this forces a new resource to be created.
     */
    @JvmName("jhgogujshbxsxaif")
    public suspend fun zone(`value`: Output) {
        this.zone = value
    }

    /**
     * @param value The ID of the Capacity Reservation Group where the Capacity Reservation exists. Changing this forces a new resource to be created.
     */
    @JvmName("nphbxsrhnblgiqhf")
    public suspend fun capacityReservationGroupId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.capacityReservationGroupId = mapped
    }

    /**
     * @param value Specifies the name of this Capacity Reservation. Changing this forces a new resource to be created.
     */
    @JvmName("ejhjhnifajphmnrd")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value A `sku` block as defined below.
     */
    @JvmName("ryrfbttifccylxlw")
    public suspend fun sku(`value`: CapacityReservationSkuArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sku = mapped
    }

    /**
     * @param argument A `sku` block as defined below.
     */
    @JvmName("bgtdeabifldacdkp")
    public suspend fun sku(argument: suspend CapacityReservationSkuArgsBuilder.() -> Unit) {
        val toBeMapped = CapacityReservationSkuArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.sku = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("byajtjkguppgxipg")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("bhnumdiifsidnojc")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Specifies the Availability Zone for this Capacity Reservation. Changing this forces a new resource to be created.
     */
    @JvmName("qrknktchboqvtdsw")
    public suspend fun zone(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.zone = mapped
    }

    internal fun build(): CapacityReservationArgs = CapacityReservationArgs(
        capacityReservationGroupId = capacityReservationGroupId,
        name = name,
        sku = sku,
        tags = tags,
        zone = zone,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy