com.pulumi.gcp.compute.kotlin.Disk.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-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.gcp.compute.kotlin
import com.pulumi.core.Output
import com.pulumi.gcp.compute.kotlin.outputs.DiskAsyncPrimaryDisk
import com.pulumi.gcp.compute.kotlin.outputs.DiskDiskEncryptionKey
import com.pulumi.gcp.compute.kotlin.outputs.DiskGuestOsFeature
import com.pulumi.gcp.compute.kotlin.outputs.DiskSourceImageEncryptionKey
import com.pulumi.gcp.compute.kotlin.outputs.DiskSourceSnapshotEncryptionKey
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.Deprecated
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.gcp.compute.kotlin.outputs.DiskAsyncPrimaryDisk.Companion.toKotlin as diskAsyncPrimaryDiskToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.DiskDiskEncryptionKey.Companion.toKotlin as diskDiskEncryptionKeyToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.DiskGuestOsFeature.Companion.toKotlin as diskGuestOsFeatureToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.DiskSourceImageEncryptionKey.Companion.toKotlin as diskSourceImageEncryptionKeyToKotlin
import com.pulumi.gcp.compute.kotlin.outputs.DiskSourceSnapshotEncryptionKey.Companion.toKotlin as diskSourceSnapshotEncryptionKeyToKotlin
/**
* Builder for [Disk].
*/
@PulumiTagMarker
public class DiskResourceBuilder internal constructor() {
public var name: String? = null
public var args: DiskArgs = DiskArgs()
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 DiskArgsBuilder.() -> Unit) {
val builder = DiskArgsBuilder()
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(): Disk {
val builtJavaResource = com.pulumi.gcp.compute.Disk(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Disk(builtJavaResource)
}
}
/**
* Persistent disks are durable storage devices that function similarly to
* the physical disks in a desktop or a server. Compute Engine manages the
* hardware behind these devices to ensure data redundancy and optimize
* performance for you. Persistent disks are available as either standard
* hard disk drives (HDD) or solid-state drives (SSD).
* Persistent disks are located independently from your virtual machine
* instances, so you can detach or move persistent disks to keep your data
* even after you delete your instances. Persistent disk performance scales
* automatically with size, so you can resize your existing persistent disks
* or add more persistent disks to an instance to meet your performance and
* storage space requirements.
* Add a persistent disk to your instance when you need reliable and
* affordable storage with consistent performance characteristics.
* To get more information about Disk, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/v1/disks)
* * How-to Guides
* * [Adding a persistent disk](https://cloud.google.com/compute/docs/disks/add-persistent-disk)
* ## Example Usage
* ### Disk Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.compute.Disk("default", {
* name: "test-disk",
* type: "pd-ssd",
* zone: "us-central1-a",
* image: "debian-11-bullseye-v20220719",
* labels: {
* environment: "dev",
* },
* physicalBlockSizeBytes: 4096,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Disk("default",
* name="test-disk",
* type="pd-ssd",
* zone="us-central1-a",
* image="debian-11-bullseye-v20220719",
* labels={
* "environment": "dev",
* },
* physical_block_size_bytes=4096)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Disk("default", new()
* {
* Name = "test-disk",
* Type = "pd-ssd",
* Zone = "us-central1-a",
* Image = "debian-11-bullseye-v20220719",
* Labels =
* {
* { "environment", "dev" },
* },
* PhysicalBlockSizeBytes = 4096,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewDisk(ctx, "default", &compute.DiskArgs{
* Name: pulumi.String("test-disk"),
* Type: pulumi.String("pd-ssd"),
* Zone: pulumi.String("us-central1-a"),
* Image: pulumi.String("debian-11-bullseye-v20220719"),
* Labels: pulumi.StringMap{
* "environment": pulumi.String("dev"),
* },
* PhysicalBlockSizeBytes: pulumi.Int(4096),
* })
* 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.gcp.compute.Disk;
* import com.pulumi.gcp.compute.DiskArgs;
* 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 Disk("default", DiskArgs.builder()
* .name("test-disk")
* .type("pd-ssd")
* .zone("us-central1-a")
* .image("debian-11-bullseye-v20220719")
* .labels(Map.of("environment", "dev"))
* .physicalBlockSizeBytes(4096)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Disk
* properties:
* name: test-disk
* type: pd-ssd
* zone: us-central1-a
* image: debian-11-bullseye-v20220719
* labels:
* environment: dev
* physicalBlockSizeBytes: 4096
* ```
*
* ### Disk Async
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const primary = new gcp.compute.Disk("primary", {
* name: "async-test-disk",
* type: "pd-ssd",
* zone: "us-central1-a",
* physicalBlockSizeBytes: 4096,
* });
* const secondary = new gcp.compute.Disk("secondary", {
* name: "async-secondary-test-disk",
* type: "pd-ssd",
* zone: "us-east1-c",
* asyncPrimaryDisk: {
* disk: primary.id,
* },
* physicalBlockSizeBytes: 4096,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* primary = gcp.compute.Disk("primary",
* name="async-test-disk",
* type="pd-ssd",
* zone="us-central1-a",
* physical_block_size_bytes=4096)
* secondary = gcp.compute.Disk("secondary",
* name="async-secondary-test-disk",
* type="pd-ssd",
* zone="us-east1-c",
* async_primary_disk=gcp.compute.DiskAsyncPrimaryDiskArgs(
* disk=primary.id,
* ),
* physical_block_size_bytes=4096)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var primary = new Gcp.Compute.Disk("primary", new()
* {
* Name = "async-test-disk",
* Type = "pd-ssd",
* Zone = "us-central1-a",
* PhysicalBlockSizeBytes = 4096,
* });
* var secondary = new Gcp.Compute.Disk("secondary", new()
* {
* Name = "async-secondary-test-disk",
* Type = "pd-ssd",
* Zone = "us-east1-c",
* AsyncPrimaryDisk = new Gcp.Compute.Inputs.DiskAsyncPrimaryDiskArgs
* {
* Disk = primary.Id,
* },
* PhysicalBlockSizeBytes = 4096,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* primary, err := compute.NewDisk(ctx, "primary", &compute.DiskArgs{
* Name: pulumi.String("async-test-disk"),
* Type: pulumi.String("pd-ssd"),
* Zone: pulumi.String("us-central1-a"),
* PhysicalBlockSizeBytes: pulumi.Int(4096),
* })
* if err != nil {
* return err
* }
* _, err = compute.NewDisk(ctx, "secondary", &compute.DiskArgs{
* Name: pulumi.String("async-secondary-test-disk"),
* Type: pulumi.String("pd-ssd"),
* Zone: pulumi.String("us-east1-c"),
* AsyncPrimaryDisk: &compute.DiskAsyncPrimaryDiskArgs{
* Disk: primary.ID(),
* },
* PhysicalBlockSizeBytes: pulumi.Int(4096),
* })
* 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.gcp.compute.Disk;
* import com.pulumi.gcp.compute.DiskArgs;
* import com.pulumi.gcp.compute.inputs.DiskAsyncPrimaryDiskArgs;
* 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 primary = new Disk("primary", DiskArgs.builder()
* .name("async-test-disk")
* .type("pd-ssd")
* .zone("us-central1-a")
* .physicalBlockSizeBytes(4096)
* .build());
* var secondary = new Disk("secondary", DiskArgs.builder()
* .name("async-secondary-test-disk")
* .type("pd-ssd")
* .zone("us-east1-c")
* .asyncPrimaryDisk(DiskAsyncPrimaryDiskArgs.builder()
* .disk(primary.id())
* .build())
* .physicalBlockSizeBytes(4096)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* primary:
* type: gcp:compute:Disk
* properties:
* name: async-test-disk
* type: pd-ssd
* zone: us-central1-a
* physicalBlockSizeBytes: 4096
* secondary:
* type: gcp:compute:Disk
* properties:
* name: async-secondary-test-disk
* type: pd-ssd
* zone: us-east1-c
* asyncPrimaryDisk:
* disk: ${primary.id}
* physicalBlockSizeBytes: 4096
* ```
*
* ### Disk Features
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const _default = new gcp.compute.Disk("default", {
* name: "test-disk-features",
* type: "pd-ssd",
* zone: "us-central1-a",
* labels: {
* environment: "dev",
* },
* guestOsFeatures: [
* {
* type: "SECURE_BOOT",
* },
* {
* type: "MULTI_IP_SUBNET",
* },
* {
* type: "WINDOWS",
* },
* ],
* licenses: ["https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core"],
* physicalBlockSizeBytes: 4096,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default = gcp.compute.Disk("default",
* name="test-disk-features",
* type="pd-ssd",
* zone="us-central1-a",
* labels={
* "environment": "dev",
* },
* guest_os_features=[
* gcp.compute.DiskGuestOsFeatureArgs(
* type="SECURE_BOOT",
* ),
* gcp.compute.DiskGuestOsFeatureArgs(
* type="MULTI_IP_SUBNET",
* ),
* gcp.compute.DiskGuestOsFeatureArgs(
* type="WINDOWS",
* ),
* ],
* licenses=["https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core"],
* physical_block_size_bytes=4096)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var @default = new Gcp.Compute.Disk("default", new()
* {
* Name = "test-disk-features",
* Type = "pd-ssd",
* Zone = "us-central1-a",
* Labels =
* {
* { "environment", "dev" },
* },
* GuestOsFeatures = new[]
* {
* new Gcp.Compute.Inputs.DiskGuestOsFeatureArgs
* {
* Type = "SECURE_BOOT",
* },
* new Gcp.Compute.Inputs.DiskGuestOsFeatureArgs
* {
* Type = "MULTI_IP_SUBNET",
* },
* new Gcp.Compute.Inputs.DiskGuestOsFeatureArgs
* {
* Type = "WINDOWS",
* },
* },
* Licenses = new[]
* {
* "https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core",
* },
* PhysicalBlockSizeBytes = 4096,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* _, err := compute.NewDisk(ctx, "default", &compute.DiskArgs{
* Name: pulumi.String("test-disk-features"),
* Type: pulumi.String("pd-ssd"),
* Zone: pulumi.String("us-central1-a"),
* Labels: pulumi.StringMap{
* "environment": pulumi.String("dev"),
* },
* GuestOsFeatures: compute.DiskGuestOsFeatureArray{
* &compute.DiskGuestOsFeatureArgs{
* Type: pulumi.String("SECURE_BOOT"),
* },
* &compute.DiskGuestOsFeatureArgs{
* Type: pulumi.String("MULTI_IP_SUBNET"),
* },
* &compute.DiskGuestOsFeatureArgs{
* Type: pulumi.String("WINDOWS"),
* },
* },
* Licenses: pulumi.StringArray{
* pulumi.String("https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core"),
* },
* PhysicalBlockSizeBytes: pulumi.Int(4096),
* })
* 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.gcp.compute.Disk;
* import com.pulumi.gcp.compute.DiskArgs;
* import com.pulumi.gcp.compute.inputs.DiskGuestOsFeatureArgs;
* 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 Disk("default", DiskArgs.builder()
* .name("test-disk-features")
* .type("pd-ssd")
* .zone("us-central1-a")
* .labels(Map.of("environment", "dev"))
* .guestOsFeatures(
* DiskGuestOsFeatureArgs.builder()
* .type("SECURE_BOOT")
* .build(),
* DiskGuestOsFeatureArgs.builder()
* .type("MULTI_IP_SUBNET")
* .build(),
* DiskGuestOsFeatureArgs.builder()
* .type("WINDOWS")
* .build())
* .licenses("https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core")
* .physicalBlockSizeBytes(4096)
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:Disk
* properties:
* name: test-disk-features
* type: pd-ssd
* zone: us-central1-a
* labels:
* environment: dev
* guestOsFeatures:
* - type: SECURE_BOOT
* - type: MULTI_IP_SUBNET
* - type: WINDOWS
* licenses:
* - https://www.googleapis.com/compute/v1/projects/windows-cloud/global/licenses/windows-server-core
* physicalBlockSizeBytes: 4096
* ```
*
* ## Import
* Disk can be imported using any of these accepted formats:
* * `projects/{{project}}/zones/{{zone}}/disks/{{name}}`
* * `{{project}}/{{zone}}/{{name}}`
* * `{{zone}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, Disk can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/disk:Disk default projects/{{project}}/zones/{{zone}}/disks/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/disk:Disk default {{project}}/{{zone}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/disk:Disk default {{zone}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/disk:Disk default {{name}}
* ```
*/
public class Disk internal constructor(
override val javaResource: com.pulumi.gcp.compute.Disk,
) : KotlinCustomResource(javaResource, DiskMapper) {
/**
* A nested object resource
* Structure is documented below.
*/
public val asyncPrimaryDisk: Output?
get() = javaResource.asyncPrimaryDisk().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> diskAsyncPrimaryDiskToKotlin(args0) })
}).orElse(null)
})
/**
* Creation timestamp in RFC3339 text format.
*/
public val creationTimestamp: Output
get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })
/**
* An optional description of this resource. Provide this property when
* you create the resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Encrypts the disk using a customer-supplied encryption key.
* After you encrypt a disk with a customer-supplied key, you must
* provide the same key if you use the disk later (e.g. to create a disk
* snapshot or an image, or to attach the disk to a virtual machine).
* Customer-supplied encryption keys do not protect access to metadata of
* the disk.
* If you do not provide an encryption key when creating the disk, then
* the disk will be encrypted using an automatically generated key and
* you do not need to provide a key to use the disk later.
* Structure is documented below.
*/
public val diskEncryptionKey: Output?
get() = javaResource.diskEncryptionKey().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> diskDiskEncryptionKeyToKotlin(args0) })
}).orElse(null)
})
/**
* The unique identifier for the resource. This identifier is defined by the server.
*/
public val diskId: Output
get() = javaResource.diskId().applyValue({ args0 -> args0 })
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
public val effectiveLabels: Output
© 2015 - 2024 Weber Informatics LLC | Privacy Policy