Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.compute.kotlin.CapacityReservation.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.compute.kotlin
import com.pulumi.azure.compute.kotlin.outputs.CapacityReservationSku
import com.pulumi.azure.compute.kotlin.outputs.CapacityReservationSku.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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [CapacityReservation].
*/
@PulumiTagMarker
public class CapacityReservationResourceBuilder internal constructor() {
public var name: String? = null
public var args: CapacityReservationArgs = CapacityReservationArgs()
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 CapacityReservationArgsBuilder.() -> Unit) {
val builder = CapacityReservationArgsBuilder()
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(): CapacityReservation {
val builtJavaResource = com.pulumi.azure.compute.CapacityReservation(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return CapacityReservation(builtJavaResource)
}
}
/**
* 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={
* "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
* ```
*/
public class CapacityReservation internal constructor(
override val javaResource: com.pulumi.azure.compute.CapacityReservation,
) : KotlinCustomResource(javaResource, CapacityReservationMapper) {
/**
* The ID of the Capacity Reservation Group where the Capacity Reservation exists. Changing this forces a new resource to be created.
*/
public val capacityReservationGroupId: Output
get() = javaResource.capacityReservationGroupId().applyValue({ args0 -> args0 })
/**
* Specifies the name of this Capacity Reservation. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A `sku` block as defined below.
*/
public val sku: Output
get() = javaResource.sku().applyValue({ args0 -> args0.let({ args0 -> toKotlin(args0) }) })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* Specifies the Availability Zone for this Capacity Reservation. Changing this forces a new resource to be created.
*/
public val zone: Output?
get() = javaResource.zone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}
public object CapacityReservationMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.compute.CapacityReservation::class == javaResource::class
override fun map(javaResource: Resource): CapacityReservation = CapacityReservation(
javaResource
as com.pulumi.azure.compute.CapacityReservation,
)
}
/**
* @see [CapacityReservation].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [CapacityReservation].
*/
public suspend fun capacityReservation(
name: String,
block: suspend CapacityReservationResourceBuilder.() -> Unit,
): CapacityReservation {
val builder = CapacityReservationResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [CapacityReservation].
* @param name The _unique_ name of the resulting resource.
*/
public fun capacityReservation(name: String): CapacityReservation {
val builder = CapacityReservationResourceBuilder()
builder.name(name)
return builder.build()
}