com.pulumi.digitalocean.kotlin.VolumeArgs.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-digitalocean-kotlin Show documentation
Show all versions of pulumi-digitalocean-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.digitalocean.kotlin
import com.pulumi.core.Either
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.digitalocean.VolumeArgs.builder
import com.pulumi.digitalocean.kotlin.enums.FileSystemType
import com.pulumi.digitalocean.kotlin.enums.Region
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName
/**
* Provides a DigitalOcean Block Storage volume which can be attached to a Droplet in order to provide expanded storage.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const foobar = new digitalocean.Volume("foobar", {
* region: digitalocean.Region.NYC1,
* name: "baz",
* size: 100,
* initialFilesystemType: digitalocean.FileSystemType.EXT4,
* description: "an example volume",
* });
* const foobarDroplet = new digitalocean.Droplet("foobar", {
* name: "baz",
* size: digitalocean.DropletSlug.DropletS1VCPU1GB,
* image: "ubuntu-18-04-x64",
* region: digitalocean.Region.NYC1,
* });
* const foobarVolumeAttachment = new digitalocean.VolumeAttachment("foobar", {
* dropletId: foobarDroplet.id,
* volumeId: foobar.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* foobar = digitalocean.Volume("foobar",
* region=digitalocean.Region.NYC1,
* name="baz",
* size=100,
* initial_filesystem_type=digitalocean.FileSystemType.EXT4,
* description="an example volume")
* foobar_droplet = digitalocean.Droplet("foobar",
* name="baz",
* size=digitalocean.DropletSlug.DROPLET_S1_VCPU1_GB,
* image="ubuntu-18-04-x64",
* region=digitalocean.Region.NYC1)
* foobar_volume_attachment = digitalocean.VolumeAttachment("foobar",
* droplet_id=foobar_droplet.id,
* volume_id=foobar.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var foobar = new DigitalOcean.Volume("foobar", new()
* {
* Region = DigitalOcean.Region.NYC1,
* Name = "baz",
* Size = 100,
* InitialFilesystemType = DigitalOcean.FileSystemType.EXT4,
* Description = "an example volume",
* });
* var foobarDroplet = new DigitalOcean.Droplet("foobar", new()
* {
* Name = "baz",
* Size = DigitalOcean.DropletSlug.DropletS1VCPU1GB,
* Image = "ubuntu-18-04-x64",
* Region = DigitalOcean.Region.NYC1,
* });
* var foobarVolumeAttachment = new DigitalOcean.VolumeAttachment("foobar", new()
* {
* DropletId = foobarDroplet.Id,
* VolumeId = foobar.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* foobar, err := digitalocean.NewVolume(ctx, "foobar", &digitalocean.VolumeArgs{
* Region: pulumi.String(digitalocean.RegionNYC1),
* Name: pulumi.String("baz"),
* Size: pulumi.Int(100),
* InitialFilesystemType: pulumi.String(digitalocean.FileSystemTypeEXT4),
* Description: pulumi.String("an example volume"),
* })
* if err != nil {
* return err
* }
* foobarDroplet, err := digitalocean.NewDroplet(ctx, "foobar", &digitalocean.DropletArgs{
* Name: pulumi.String("baz"),
* Size: pulumi.String(digitalocean.DropletSlugDropletS1VCPU1GB),
* Image: pulumi.String("ubuntu-18-04-x64"),
* Region: pulumi.String(digitalocean.RegionNYC1),
* })
* if err != nil {
* return err
* }
* _, err = digitalocean.NewVolumeAttachment(ctx, "foobar", &digitalocean.VolumeAttachmentArgs{
* DropletId: foobarDroplet.ID(),
* VolumeId: foobar.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.digitalocean.Volume;
* import com.pulumi.digitalocean.VolumeArgs;
* import com.pulumi.digitalocean.Droplet;
* import com.pulumi.digitalocean.DropletArgs;
* import com.pulumi.digitalocean.VolumeAttachment;
* import com.pulumi.digitalocean.VolumeAttachmentArgs;
* 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 foobar = new Volume("foobar", VolumeArgs.builder()
* .region("nyc1")
* .name("baz")
* .size(100)
* .initialFilesystemType("ext4")
* .description("an example volume")
* .build());
* var foobarDroplet = new Droplet("foobarDroplet", DropletArgs.builder()
* .name("baz")
* .size("s-1vcpu-1gb")
* .image("ubuntu-18-04-x64")
* .region("nyc1")
* .build());
* var foobarVolumeAttachment = new VolumeAttachment("foobarVolumeAttachment", VolumeAttachmentArgs.builder()
* .dropletId(foobarDroplet.id())
* .volumeId(foobar.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobar:
* type: digitalocean:Volume
* properties:
* region: nyc1
* name: baz
* size: 100
* initialFilesystemType: ext4
* description: an example volume
* foobarDroplet:
* type: digitalocean:Droplet
* name: foobar
* properties:
* name: baz
* size: s-1vcpu-1gb
* image: ubuntu-18-04-x64
* region: nyc1
* foobarVolumeAttachment:
* type: digitalocean:VolumeAttachment
* name: foobar
* properties:
* dropletId: ${foobarDroplet.id}
* volumeId: ${foobar.id}
* ```
*
* You can also create a volume from an existing snapshot.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as digitalocean from "@pulumi/digitalocean";
* const foobar = digitalocean.getVolumeSnapshot({
* name: "baz",
* });
* const foobarVolume = new digitalocean.Volume("foobar", {
* region: digitalocean.Region.LON1,
* name: "foo",
* size: foobar.then(foobar => foobar.minDiskSize),
* snapshotId: foobar.then(foobar => foobar.id),
* });
* ```
* ```python
* import pulumi
* import pulumi_digitalocean as digitalocean
* foobar = digitalocean.get_volume_snapshot(name="baz")
* foobar_volume = digitalocean.Volume("foobar",
* region=digitalocean.Region.LON1,
* name="foo",
* size=foobar.min_disk_size,
* snapshot_id=foobar.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using DigitalOcean = Pulumi.DigitalOcean;
* return await Deployment.RunAsync(() =>
* {
* var foobar = DigitalOcean.GetVolumeSnapshot.Invoke(new()
* {
* Name = "baz",
* });
* var foobarVolume = new DigitalOcean.Volume("foobar", new()
* {
* Region = DigitalOcean.Region.LON1,
* Name = "foo",
* Size = foobar.Apply(getVolumeSnapshotResult => getVolumeSnapshotResult.MinDiskSize),
* SnapshotId = foobar.Apply(getVolumeSnapshotResult => getVolumeSnapshotResult.Id),
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* foobar, err := digitalocean.LookupVolumeSnapshot(ctx, &digitalocean.LookupVolumeSnapshotArgs{
* Name: pulumi.StringRef("baz"),
* }, nil)
* if err != nil {
* return err
* }
* _, err = digitalocean.NewVolume(ctx, "foobar", &digitalocean.VolumeArgs{
* Region: pulumi.String(digitalocean.RegionLON1),
* Name: pulumi.String("foo"),
* Size: pulumi.Int(foobar.MinDiskSize),
* SnapshotId: pulumi.String(foobar.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.digitalocean.DigitaloceanFunctions;
* import com.pulumi.digitalocean.inputs.GetVolumeSnapshotArgs;
* import com.pulumi.digitalocean.Volume;
* import com.pulumi.digitalocean.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) {
* final var foobar = DigitaloceanFunctions.getVolumeSnapshot(GetVolumeSnapshotArgs.builder()
* .name("baz")
* .build());
* var foobarVolume = new Volume("foobarVolume", VolumeArgs.builder()
* .region("lon1")
* .name("foo")
* .size(foobar.applyValue(getVolumeSnapshotResult -> getVolumeSnapshotResult.minDiskSize()))
* .snapshotId(foobar.applyValue(getVolumeSnapshotResult -> getVolumeSnapshotResult.id()))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* foobarVolume:
* type: digitalocean:Volume
* name: foobar
* properties:
* region: lon1
* name: foo
* size: ${foobar.minDiskSize}
* snapshotId: ${foobar.id}
* variables:
* foobar:
* fn::invoke:
* Function: digitalocean:getVolumeSnapshot
* Arguments:
* name: baz
* ```
*
* ## Import
* Volumes can be imported using the `volume id`, e.g.
* ```sh
* $ pulumi import digitalocean:index/volume:Volume volume 506f78a4-e098-11e5-ad9f-000f53306ae1
* ```
* @property description A free-form text field up to a limit of 1024 bytes to describe a block storage volume.
* @property filesystemType Filesystem type (`xfs` or `ext4`) for the block storage volume.
* @property initialFilesystemLabel Initial filesystem label for the block storage volume.
* @property initialFilesystemType Initial filesystem type (`xfs` or `ext4`) for the block storage volume.
* @property name A name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter.
* @property region The region that the block storage volume will be created in.
* @property size The size of the block storage volume in GiB. If updated, can only be expanded.
* @property snapshotId The ID of an existing volume snapshot from which the new volume will be created. If supplied, the region and size will be limited on creation to that of the referenced snapshot
* @property tags A list of the tags to be applied to this Volume.
*/
public data class VolumeArgs(
public val description: Output? = null,
@Deprecated(
message = """
This fields functionality has been replaced by `initial_filesystem_type`. The property will still
remain as a computed attribute representing the current volumes filesystem type.
""",
)
public val filesystemType: Output? = null,
public val initialFilesystemLabel: Output? = null,
public val initialFilesystemType: Output>? = null,
public val name: Output? = null,
public val region: Output>? = null,
public val size: Output? = null,
public val snapshotId: Output? = null,
public val tags: Output>? = null,
) : ConvertibleToJava {
override fun toJava(): com.pulumi.digitalocean.VolumeArgs =
com.pulumi.digitalocean.VolumeArgs.builder()
.description(description?.applyValue({ args0 -> args0 }))
.filesystemType(filesystemType?.applyValue({ args0 -> args0 }))
.initialFilesystemLabel(initialFilesystemLabel?.applyValue({ args0 -> args0 }))
.initialFilesystemType(
initialFilesystemType?.applyValue({ args0 ->
args0.transform({ args0 ->
args0
}, { args0 -> args0.let({ args0 -> args0.toJava() }) })
}),
)
.name(name?.applyValue({ args0 -> args0 }))
.region(
region?.applyValue({ args0 ->
args0.transform({ args0 -> args0 }, { args0 ->
args0.let({ args0 -> args0.toJava() })
})
}),
)
.size(size?.applyValue({ args0 -> args0 }))
.snapshotId(snapshotId?.applyValue({ args0 -> args0 }))
.tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0 }) })).build()
}
/**
* Builder for [VolumeArgs].
*/
@PulumiTagMarker
public class VolumeArgsBuilder internal constructor() {
private var description: Output? = null
private var filesystemType: Output? = null
private var initialFilesystemLabel: Output? = null
private var initialFilesystemType: Output>? = null
private var name: Output? = null
private var region: Output>? = null
private var size: Output? = null
private var snapshotId: Output? = null
private var tags: Output>? = null
/**
* @param value A free-form text field up to a limit of 1024 bytes to describe a block storage volume.
*/
@JvmName("jrgvqlfngihmbioo")
public suspend fun description(`value`: Output) {
this.description = value
}
/**
* @param value Filesystem type (`xfs` or `ext4`) for the block storage volume.
*/
@Deprecated(
message = """
This fields functionality has been replaced by `initial_filesystem_type`. The property will still
remain as a computed attribute representing the current volumes filesystem type.
""",
)
@JvmName("nffkpuqfbepdbbxm")
public suspend fun filesystemType(`value`: Output) {
this.filesystemType = value
}
/**
* @param value Initial filesystem label for the block storage volume.
*/
@JvmName("ldwxesnwvwjpswqy")
public suspend fun initialFilesystemLabel(`value`: Output) {
this.initialFilesystemLabel = value
}
/**
* @param value Initial filesystem type (`xfs` or `ext4`) for the block storage volume.
*/
@JvmName("igrqykiwlggmuewg")
public suspend fun initialFilesystemType(`value`: Output>) {
this.initialFilesystemType = value
}
/**
* @param value A name for the block storage volume. Must be lowercase and be composed only of numbers, letters and "-", up to a limit of 64 characters. The name must begin with a letter.
*/
@JvmName("gblutlxwfayybwyh")
public suspend fun name(`value`: Output) {
this.name = value
}
/**
* @param value The region that the block storage volume will be created in.
*/
@JvmName("wuimwikhsdwkyuoj")
public suspend fun region(`value`: Output>) {
this.region = value
}
/**
* @param value The size of the block storage volume in GiB. If updated, can only be expanded.
*/
@JvmName("okivtnkflofitksd")
public suspend fun size(`value`: Output) {
this.size = value
}
/**
* @param value The ID of an existing volume snapshot from which the new volume will be created. If supplied, the region and size will be limited on creation to that of the referenced snapshot
*/
@JvmName("rjukkbragcxpjuej")
public suspend fun snapshotId(`value`: Output) {
this.snapshotId = value
}
/**
* @param value A list of the tags to be applied to this Volume.
*/
@JvmName("ddftayivqfdtgcbx")
public suspend fun tags(`value`: Output>) {
this.tags = value
}
@JvmName("yeigehygqrybleup")
public suspend fun tags(vararg values: Output) {
this.tags = Output.all(values.asList())
}
/**
* @param values A list of the tags to be applied to this Volume.
*/
@JvmName("snwnmlyskqgitukn")
public suspend fun tags(values: List