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.elasticsan.kotlin.Volume.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.elasticsan.kotlin
import com.pulumi.azure.elasticsan.kotlin.outputs.VolumeCreateSource
import com.pulumi.azure.elasticsan.kotlin.outputs.VolumeCreateSource.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
/**
* Builder for [Volume].
*/
@PulumiTagMarker
public class VolumeResourceBuilder internal constructor() {
public var name: String? = null
public var args: VolumeArgs = VolumeArgs()
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 VolumeArgsBuilder.() -> Unit) {
val builder = VolumeArgsBuilder()
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(): Volume {
val builtJavaResource = com.pulumi.azure.elasticsan.Volume(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Volume(builtJavaResource)
}
}
/**
* Manages an Elastic SAN Volume resource.
* ## 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 exampleElasticSan = new azure.elasticsan.ElasticSan("example", {
* name: "example-es",
* resourceGroupName: example.name,
* location: example.location,
* baseSizeInTib: 1,
* sku: {
* name: "Premium_LRS",
* },
* });
* const exampleVolumeGroup = new azure.elasticsan.VolumeGroup("example", {
* name: "example-esvg",
* elasticSanId: exampleElasticSan.id,
* });
* const exampleVolume = new azure.elasticsan.Volume("example", {
* name: "example-esv",
* volumeGroupId: exampleVolumeGroup.id,
* sizeInGib: 1,
* });
* export const targetIqn = exampleVolume.targetIqn;
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-rg",
* location="West Europe")
* example_elastic_san = azure.elasticsan.ElasticSan("example",
* name="example-es",
* resource_group_name=example.name,
* location=example.location,
* base_size_in_tib=1,
* sku={
* "name": "Premium_LRS",
* })
* example_volume_group = azure.elasticsan.VolumeGroup("example",
* name="example-esvg",
* elastic_san_id=example_elastic_san.id)
* example_volume = azure.elasticsan.Volume("example",
* name="example-esv",
* volume_group_id=example_volume_group.id,
* size_in_gib=1)
* pulumi.export("targetIqn", example_volume.target_iqn)
* ```
* ```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 exampleElasticSan = new Azure.ElasticSan.ElasticSan("example", new()
* {
* Name = "example-es",
* ResourceGroupName = example.Name,
* Location = example.Location,
* BaseSizeInTib = 1,
* Sku = new Azure.ElasticSan.Inputs.ElasticSanSkuArgs
* {
* Name = "Premium_LRS",
* },
* });
* var exampleVolumeGroup = new Azure.ElasticSan.VolumeGroup("example", new()
* {
* Name = "example-esvg",
* ElasticSanId = exampleElasticSan.Id,
* });
* var exampleVolume = new Azure.ElasticSan.Volume("example", new()
* {
* Name = "example-esv",
* VolumeGroupId = exampleVolumeGroup.Id,
* SizeInGib = 1,
* });
* return new Dictionary
* {
* ["targetIqn"] = exampleVolume.TargetIqn,
* };
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/elasticsan"
* "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
* }
* exampleElasticSan, err := elasticsan.NewElasticSan(ctx, "example", &elasticsan.ElasticSanArgs{
* Name: pulumi.String("example-es"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* BaseSizeInTib: pulumi.Int(1),
* Sku: &elasticsan.ElasticSanSkuArgs{
* Name: pulumi.String("Premium_LRS"),
* },
* })
* if err != nil {
* return err
* }
* exampleVolumeGroup, err := elasticsan.NewVolumeGroup(ctx, "example", &elasticsan.VolumeGroupArgs{
* Name: pulumi.String("example-esvg"),
* ElasticSanId: exampleElasticSan.ID(),
* })
* if err != nil {
* return err
* }
* exampleVolume, err := elasticsan.NewVolume(ctx, "example", &elasticsan.VolumeArgs{
* Name: pulumi.String("example-esv"),
* VolumeGroupId: exampleVolumeGroup.ID(),
* SizeInGib: pulumi.Int(1),
* })
* if err != nil {
* return err
* }
* ctx.Export("targetIqn", exampleVolume.TargetIqn)
* 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.elasticsan.ElasticSan;
* import com.pulumi.azure.elasticsan.ElasticSanArgs;
* import com.pulumi.azure.elasticsan.inputs.ElasticSanSkuArgs;
* import com.pulumi.azure.elasticsan.VolumeGroup;
* import com.pulumi.azure.elasticsan.VolumeGroupArgs;
* import com.pulumi.azure.elasticsan.Volume;
* import com.pulumi.azure.elasticsan.VolumeArgs;
* 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 exampleElasticSan = new ElasticSan("exampleElasticSan", ElasticSanArgs.builder()
* .name("example-es")
* .resourceGroupName(example.name())
* .location(example.location())
* .baseSizeInTib(1)
* .sku(ElasticSanSkuArgs.builder()
* .name("Premium_LRS")
* .build())
* .build());
* var exampleVolumeGroup = new VolumeGroup("exampleVolumeGroup", VolumeGroupArgs.builder()
* .name("example-esvg")
* .elasticSanId(exampleElasticSan.id())
* .build());
* var exampleVolume = new Volume("exampleVolume", VolumeArgs.builder()
* .name("example-esv")
* .volumeGroupId(exampleVolumeGroup.id())
* .sizeInGib(1)
* .build());
* ctx.export("targetIqn", exampleVolume.targetIqn());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-rg
* location: West Europe
* exampleElasticSan:
* type: azure:elasticsan:ElasticSan
* name: example
* properties:
* name: example-es
* resourceGroupName: ${example.name}
* location: ${example.location}
* baseSizeInTib: 1
* sku:
* name: Premium_LRS
* exampleVolumeGroup:
* type: azure:elasticsan:VolumeGroup
* name: example
* properties:
* name: example-esvg
* elasticSanId: ${exampleElasticSan.id}
* exampleVolume:
* type: azure:elasticsan:Volume
* name: example
* properties:
* name: example-esv
* volumeGroupId: ${exampleVolumeGroup.id}
* sizeInGib: 1
* outputs:
* targetIqn: ${exampleVolume.targetIqn}
* ```
*
* ## Example of creating an Elastic SAN Volume from a Disk Snapshot
*
* ```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 exampleElasticSan = new azure.elasticsan.ElasticSan("example", {
* name: "example-es",
* resourceGroupName: example.name,
* location: example.location,
* baseSizeInTib: 1,
* sku: {
* name: "Premium_LRS",
* },
* });
* const exampleVolumeGroup = new azure.elasticsan.VolumeGroup("example", {
* name: "example-esvg",
* elasticSanId: exampleElasticSan.id,
* });
* const exampleManagedDisk = new azure.compute.ManagedDisk("example", {
* name: "example-disk",
* location: example.location,
* resourceGroupName: example.name,
* createOption: "Empty",
* storageAccountType: "Standard_LRS",
* diskSizeGb: 2,
* });
* const exampleSnapshot = new azure.compute.Snapshot("example", {
* name: "example-ss",
* location: example.location,
* resourceGroupName: example.name,
* createOption: "Copy",
* sourceUri: exampleManagedDisk.id,
* });
* const example2 = new azure.elasticsan.Volume("example2", {
* name: "example-esv2",
* volumeGroupId: exampleVolumeGroup.id,
* sizeInGib: 2,
* createSource: {
* sourceType: "DiskSnapshot",
* sourceId: exampleSnapshot.id,
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-rg",
* location="West Europe")
* example_elastic_san = azure.elasticsan.ElasticSan("example",
* name="example-es",
* resource_group_name=example.name,
* location=example.location,
* base_size_in_tib=1,
* sku={
* "name": "Premium_LRS",
* })
* example_volume_group = azure.elasticsan.VolumeGroup("example",
* name="example-esvg",
* elastic_san_id=example_elastic_san.id)
* example_managed_disk = azure.compute.ManagedDisk("example",
* name="example-disk",
* location=example.location,
* resource_group_name=example.name,
* create_option="Empty",
* storage_account_type="Standard_LRS",
* disk_size_gb=2)
* example_snapshot = azure.compute.Snapshot("example",
* name="example-ss",
* location=example.location,
* resource_group_name=example.name,
* create_option="Copy",
* source_uri=example_managed_disk.id)
* example2 = azure.elasticsan.Volume("example2",
* name="example-esv2",
* volume_group_id=example_volume_group.id,
* size_in_gib=2,
* create_source={
* "source_type": "DiskSnapshot",
* "source_id": example_snapshot.id,
* })
* ```
* ```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 exampleElasticSan = new Azure.ElasticSan.ElasticSan("example", new()
* {
* Name = "example-es",
* ResourceGroupName = example.Name,
* Location = example.Location,
* BaseSizeInTib = 1,
* Sku = new Azure.ElasticSan.Inputs.ElasticSanSkuArgs
* {
* Name = "Premium_LRS",
* },
* });
* var exampleVolumeGroup = new Azure.ElasticSan.VolumeGroup("example", new()
* {
* Name = "example-esvg",
* ElasticSanId = exampleElasticSan.Id,
* });
* var exampleManagedDisk = new Azure.Compute.ManagedDisk("example", new()
* {
* Name = "example-disk",
* Location = example.Location,
* ResourceGroupName = example.Name,
* CreateOption = "Empty",
* StorageAccountType = "Standard_LRS",
* DiskSizeGb = 2,
* });
* var exampleSnapshot = new Azure.Compute.Snapshot("example", new()
* {
* Name = "example-ss",
* Location = example.Location,
* ResourceGroupName = example.Name,
* CreateOption = "Copy",
* SourceUri = exampleManagedDisk.Id,
* });
* var example2 = new Azure.ElasticSan.Volume("example2", new()
* {
* Name = "example-esv2",
* VolumeGroupId = exampleVolumeGroup.Id,
* SizeInGib = 2,
* CreateSource = new Azure.ElasticSan.Inputs.VolumeCreateSourceArgs
* {
* SourceType = "DiskSnapshot",
* SourceId = exampleSnapshot.Id,
* },
* });
* });
* ```
* ```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-azure/sdk/v5/go/azure/elasticsan"
* "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
* }
* exampleElasticSan, err := elasticsan.NewElasticSan(ctx, "example", &elasticsan.ElasticSanArgs{
* Name: pulumi.String("example-es"),
* ResourceGroupName: example.Name,
* Location: example.Location,
* BaseSizeInTib: pulumi.Int(1),
* Sku: &elasticsan.ElasticSanSkuArgs{
* Name: pulumi.String("Premium_LRS"),
* },
* })
* if err != nil {
* return err
* }
* exampleVolumeGroup, err := elasticsan.NewVolumeGroup(ctx, "example", &elasticsan.VolumeGroupArgs{
* Name: pulumi.String("example-esvg"),
* ElasticSanId: exampleElasticSan.ID(),
* })
* if err != nil {
* return err
* }
* exampleManagedDisk, err := compute.NewManagedDisk(ctx, "example", &compute.ManagedDiskArgs{
* Name: pulumi.String("example-disk"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* CreateOption: pulumi.String("Empty"),
* StorageAccountType: pulumi.String("Standard_LRS"),
* DiskSizeGb: pulumi.Int(2),
* })
* if err != nil {
* return err
* }
* exampleSnapshot, err := compute.NewSnapshot(ctx, "example", &compute.SnapshotArgs{
* Name: pulumi.String("example-ss"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* CreateOption: pulumi.String("Copy"),
* SourceUri: exampleManagedDisk.ID(),
* })
* if err != nil {
* return err
* }
* _, err = elasticsan.NewVolume(ctx, "example2", &elasticsan.VolumeArgs{
* Name: pulumi.String("example-esv2"),
* VolumeGroupId: exampleVolumeGroup.ID(),
* SizeInGib: pulumi.Int(2),
* CreateSource: &elasticsan.VolumeCreateSourceArgs{
* SourceType: pulumi.String("DiskSnapshot"),
* SourceId: exampleSnapshot.ID(),
* },
* })
* 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.elasticsan.ElasticSan;
* import com.pulumi.azure.elasticsan.ElasticSanArgs;
* import com.pulumi.azure.elasticsan.inputs.ElasticSanSkuArgs;
* import com.pulumi.azure.elasticsan.VolumeGroup;
* import com.pulumi.azure.elasticsan.VolumeGroupArgs;
* import com.pulumi.azure.compute.ManagedDisk;
* import com.pulumi.azure.compute.ManagedDiskArgs;
* import com.pulumi.azure.compute.Snapshot;
* import com.pulumi.azure.compute.SnapshotArgs;
* import com.pulumi.azure.elasticsan.Volume;
* import com.pulumi.azure.elasticsan.VolumeArgs;
* import com.pulumi.azure.elasticsan.inputs.VolumeCreateSourceArgs;
* 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 exampleElasticSan = new ElasticSan("exampleElasticSan", ElasticSanArgs.builder()
* .name("example-es")
* .resourceGroupName(example.name())
* .location(example.location())
* .baseSizeInTib(1)
* .sku(ElasticSanSkuArgs.builder()
* .name("Premium_LRS")
* .build())
* .build());
* var exampleVolumeGroup = new VolumeGroup("exampleVolumeGroup", VolumeGroupArgs.builder()
* .name("example-esvg")
* .elasticSanId(exampleElasticSan.id())
* .build());
* var exampleManagedDisk = new ManagedDisk("exampleManagedDisk", ManagedDiskArgs.builder()
* .name("example-disk")
* .location(example.location())
* .resourceGroupName(example.name())
* .createOption("Empty")
* .storageAccountType("Standard_LRS")
* .diskSizeGb(2)
* .build());
* var exampleSnapshot = new Snapshot("exampleSnapshot", SnapshotArgs.builder()
* .name("example-ss")
* .location(example.location())
* .resourceGroupName(example.name())
* .createOption("Copy")
* .sourceUri(exampleManagedDisk.id())
* .build());
* var example2 = new Volume("example2", VolumeArgs.builder()
* .name("example-esv2")
* .volumeGroupId(exampleVolumeGroup.id())
* .sizeInGib(2)
* .createSource(VolumeCreateSourceArgs.builder()
* .sourceType("DiskSnapshot")
* .sourceId(exampleSnapshot.id())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-rg
* location: West Europe
* exampleElasticSan:
* type: azure:elasticsan:ElasticSan
* name: example
* properties:
* name: example-es
* resourceGroupName: ${example.name}
* location: ${example.location}
* baseSizeInTib: 1
* sku:
* name: Premium_LRS
* exampleVolumeGroup:
* type: azure:elasticsan:VolumeGroup
* name: example
* properties:
* name: example-esvg
* elasticSanId: ${exampleElasticSan.id}
* exampleManagedDisk:
* type: azure:compute:ManagedDisk
* name: example
* properties:
* name: example-disk
* location: ${example.location}
* resourceGroupName: ${example.name}
* createOption: Empty
* storageAccountType: Standard_LRS
* diskSizeGb: 2
* exampleSnapshot:
* type: azure:compute:Snapshot
* name: example
* properties:
* name: example-ss
* location: ${example.location}
* resourceGroupName: ${example.name}
* createOption: Copy
* sourceUri: ${exampleManagedDisk.id}
* example2:
* type: azure:elasticsan:Volume
* properties:
* name: example-esv2
* volumeGroupId: ${exampleVolumeGroup.id}
* sizeInGib: 2
* createSource:
* sourceType: DiskSnapshot
* sourceId: ${exampleSnapshot.id}
* ```
*
* ## Import
* An existing Elastic SAN Volume can be imported into Terraform using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:elasticsan/volume:Volume example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ElasticSan/elasticSans/esan1/volumeGroups/vg1/volumes/vol1
* ```
*/
public class Volume internal constructor(
override val javaResource: com.pulumi.azure.elasticsan.Volume,
) : KotlinCustomResource(javaResource, VolumeMapper) {
/**
* A `create_source` block as defined below.
*/
public val createSource: Output?
get() = javaResource.createSource().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
toKotlin(args0)
})
}).orElse(null)
})
/**
* Specifies the name of this Elastic SAN Volume. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Specifies the size of the Elastic SAN Volume in GiB. The size should be within the remaining capacity of the parent Elastic SAN. Possible values are between `1` and `65536` (16 TiB).
* > **NOTE:** The size can only be increased. If `create_source` is specified, then the size must be equal to or greater than the source's size.
*/
public val sizeInGib: Output
get() = javaResource.sizeInGib().applyValue({ args0 -> args0 })
/**
* The iSCSI Target IQN of the Elastic SAN Volume.
*/
public val targetIqn: Output
get() = javaResource.targetIqn().applyValue({ args0 -> args0 })
/**
* The iSCSI Target Portal Host Name of the Elastic SAN Volume.
*/
public val targetPortalHostname: Output
get() = javaResource.targetPortalHostname().applyValue({ args0 -> args0 })
/**
* The iSCSI Target Portal Port of the Elastic SAN Volume.
*/
public val targetPortalPort: Output
get() = javaResource.targetPortalPort().applyValue({ args0 -> args0 })
/**
* Specifies the Volume Group ID within which this Elastic SAN Volume should exist. Changing this forces a new resource to be created.
*/
public val volumeGroupId: Output
get() = javaResource.volumeGroupId().applyValue({ args0 -> args0 })
/**
* The UUID of the Elastic SAN Volume.
*/
public val volumeId: Output
get() = javaResource.volumeId().applyValue({ args0 -> args0 })
}
public object VolumeMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.elasticsan.Volume::class == javaResource::class
override fun map(javaResource: Resource): Volume = Volume(
javaResource as
com.pulumi.azure.elasticsan.Volume,
)
}
/**
* @see [Volume].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Volume].
*/
public suspend fun volume(name: String, block: suspend VolumeResourceBuilder.() -> Unit): Volume {
val builder = VolumeResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Volume].
* @param name The _unique_ name of the resulting resource.
*/
public fun volume(name: String): Volume {
val builder = VolumeResourceBuilder()
builder.name(name)
return builder.build()
}