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

com.pulumi.gcp.compute.kotlin.Disk.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 8.10.0.0
Show newest version
@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>
        get() = javaResource.effectiveLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Whether this disk is using confidential compute mode.
     * Note: Only supported on hyperdisk skus, disk_encryption_key is required when setting to true
     */
    public val enableConfidentialCompute: Output
        get() = javaResource.enableConfidentialCompute().applyValue({ args0 -> args0 })

    /**
     * A list of features to enable on the guest operating system.
     * Applicable only for bootable disks.
     * Structure is documented below.
     */
    public val guestOsFeatures: Output>
        get() = javaResource.guestOsFeatures().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> diskGuestOsFeatureToKotlin(args0) })
            })
        })

    /**
     * The image from which to initialize this disk. This can be
     * one of: the image's `self_link`, `projects/{project}/global/images/{image}`,
     * `projects/{project}/global/images/family/{family}`, `global/images/{image}`,
     * `global/images/family/{family}`, `family/{family}`, `{project}/{family}`,
     * `{project}/{image}`, `{family}`, or `{image}`. If referred by family, the
     * images names must include the family name. If they don't, use the
     * [gcp.compute.Image data source](https://www.terraform.io/docs/providers/google/d/compute_image.html).
     * For instance, the image `centos-6-v20180104` includes its family name `centos-6`.
     * These images can be referred by family name here.
     */
    public val image: Output?
        get() = javaResource.image().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Specifies the disk interface to use for attaching this disk, which is either SCSI or NVME. The default is SCSI.
     * > **Warning:** `interface` is deprecated and will be removed in a future major release. This field is no longer used and can be safely removed from your configurations; disk interfaces are automatically determined on attachment.
     */
    @Deprecated(
        message = """
  `interface` is deprecated and will be removed in a future major release. This field is no longer
      used and can be safely removed from your configurations; disk interfaces are automatically
      determined on attachment.
  """,
    )
    public val `interface`: Output?
        get() = javaResource.interface_().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The fingerprint used for optimistic locking of this resource.  Used
     * internally during updates.
     */
    public val labelFingerprint: Output
        get() = javaResource.labelFingerprint().applyValue({ args0 -> args0 })

    /**
     * Labels to apply to this disk.  A list of key->value pairs.
     * **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
     * Please refer to the field `effective_labels` for all of the labels present on the resource.
     */
    public val labels: Output>?
        get() = javaResource.labels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })

    /**
     * Last attach timestamp in RFC3339 text format.
     */
    public val lastAttachTimestamp: Output
        get() = javaResource.lastAttachTimestamp().applyValue({ args0 -> args0 })

    /**
     * Last detach timestamp in RFC3339 text format.
     */
    public val lastDetachTimestamp: Output
        get() = javaResource.lastDetachTimestamp().applyValue({ args0 -> args0 })

    /**
     * Any applicable license URI.
     */
    public val licenses: Output>
        get() = javaResource.licenses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Indicates whether or not the disk can be read/write attached to more than one instance.
     */
    public val multiWriter: Output?
        get() = javaResource.multiWriter().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Name of the resource. Provided by the client when the resource is
     * created. The name must be 1-63 characters long, and comply with
     * RFC1035. Specifically, the name must be 1-63 characters long and match
     * the regular expression `a-z?` which means the
     * first character must be a lowercase letter, and all following
     * characters must be a dash, lowercase letter, or digit, except the last
     * character, which cannot be a dash.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Physical block size of the persistent disk, in bytes. If not present
     * in a request, a default value is used. Currently supported sizes
     * are 4096 and 16384, other sizes may be added in the future.
     * If an unsupported value is requested, the error message will list
     * the supported values for the caller's project.
     */
    public val physicalBlockSizeBytes: Output
        get() = javaResource.physicalBlockSizeBytes().applyValue({ args0 -> args0 })

    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Indicates how many IOPS must be provisioned for the disk.
     * Note: Updating currently is only supported by hyperdisk skus without the need to delete and recreate the disk, hyperdisk
     * allows for an update of IOPS every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it
     */
    public val provisionedIops: Output
        get() = javaResource.provisionedIops().applyValue({ args0 -> args0 })

    /**
     * Indicates how much Throughput must be provisioned for the disk.
     * Note: Updating currently is only supported by hyperdisk skus without the need to delete and recreate the disk, hyperdisk
     * allows for an update of Throughput every 4 hours. To update your hyperdisk more frequently, you'll need to manually delete and recreate it
     */
    public val provisionedThroughput: Output
        get() = javaResource.provisionedThroughput().applyValue({ args0 -> args0 })

    /**
     * The combination of labels configured directly on the resource
     * and default labels configured on the provider.
     */
    public val pulumiLabels: Output>
        get() = javaResource.pulumiLabels().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.key.to(args0.value)
            }).toMap()
        })

    /**
     * Resource policies applied to this disk for automatic snapshot creations.
     * ~>**NOTE** This value does not support updating the
     * resource policy, as resource policies can not be updated more than
     * one at a time. Use
     * `gcp.compute.DiskResourcePolicyAttachment`
     * to allow for updating the resource policy attached to the disk.
     */
    public val resourcePolicies: Output>
        get() = javaResource.resourcePolicies().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * The URI of the created resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Size of the persistent disk, specified in GB. You can specify this
     * field when creating a persistent disk using the `image` or
     * `snapshot` parameter, or specify it alone to create an empty
     * persistent disk.
     * If you specify this field along with `image` or `snapshot`,
     * the value must not be less than the size of the image
     * or the size of the snapshot.
     * ~>**NOTE** If you change the size, the provider updates the disk size
     * if upsizing is detected but recreates the disk if downsizing is requested.
     * You can add `lifecycle.prevent_destroy` in the config to prevent destroying
     * and recreating.
     */
    public val size: Output
        get() = javaResource.size().applyValue({ args0 -> args0 })

    /**
     * The source snapshot used to create this disk. You can provide this as
     * a partial or full URL to the resource. If the snapshot is in another
     * project than this disk, you must supply a full URL. For example, the
     * following are valid values:
     * * `https://www.googleapis.com/compute/v1/projects/project/global/snapshots/snapshot`
     * * `projects/project/global/snapshots/snapshot`
     * * `global/snapshots/snapshot`
     */
    public val snapshot: Output?
        get() = javaResource.snapshot().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * The source disk used to create this disk. You can provide this as a partial or full URL to the resource.
     * For example, the following are valid values:
     * * https://www.googleapis.com/compute/v1/projects/{project}/zones/{zone}/disks/{disk}
     * * https://www.googleapis.com/compute/v1/projects/{project}/regions/{region}/disks/{disk}
     * * projects/{project}/zones/{zone}/disks/{disk}
     * * projects/{project}/regions/{region}/disks/{disk}
     * * zones/{zone}/disks/{disk}
     * * regions/{region}/disks/{disk}
     */
    public val sourceDisk: Output?
        get() = javaResource.sourceDisk().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The ID value of the disk used to create this image. This value may
     * be used to determine whether the image was taken from the current
     * or a previous instance of a given disk name.
     */
    public val sourceDiskId: Output
        get() = javaResource.sourceDiskId().applyValue({ args0 -> args0 })

    /**
     * The customer-supplied encryption key of the source image. Required if
     * the source image is protected by a customer-supplied encryption key.
     * Structure is documented below.
     */
    public val sourceImageEncryptionKey: Output?
        get() = javaResource.sourceImageEncryptionKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> diskSourceImageEncryptionKeyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The ID value of the image used to create this disk. This value
     * identifies the exact image that was used to create this persistent
     * disk. For example, if you created the persistent disk from an image
     * that was later deleted and recreated under the same name, the source
     * image ID would identify the exact version of the image that was used.
     */
    public val sourceImageId: Output
        get() = javaResource.sourceImageId().applyValue({ args0 -> args0 })

    /**
     * The customer-supplied encryption key of the source snapshot. Required
     * if the source snapshot is protected by a customer-supplied encryption
     * key.
     * Structure is documented below.
     */
    public val sourceSnapshotEncryptionKey: Output?
        get() = javaResource.sourceSnapshotEncryptionKey().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> diskSourceSnapshotEncryptionKeyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * The unique ID of the snapshot used to create this disk. This value
     * identifies the exact snapshot that was used to create this persistent
     * disk. For example, if you created the persistent disk from a snapshot
     * that was later deleted and recreated under the same name, the source
     * snapshot ID would identify the exact version of the snapshot that was
     * used.
     */
    public val sourceSnapshotId: Output
        get() = javaResource.sourceSnapshotId().applyValue({ args0 -> args0 })

    /**
     * URL of the disk type resource describing which disk type to use to
     * create the disk. Provide this when creating the disk.
     */
    public val type: Output?
        get() = javaResource.type().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * Links to the users of the disk (attached instances) in form:
     * project/zones/zone/instances/instance
     */
    public val users: Output>
        get() = javaResource.users().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A reference to the zone where the disk resides.
     */
    public val zone: Output
        get() = javaResource.zone().applyValue({ args0 -> args0 })
}

public object DiskMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.compute.Disk::class == javaResource::class

    override fun map(javaResource: Resource): Disk = Disk(javaResource as com.pulumi.gcp.compute.Disk)
}

/**
 * @see [Disk].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [Disk].
 */
public suspend fun disk(name: String, block: suspend DiskResourceBuilder.() -> Unit): Disk {
    val builder = DiskResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [Disk].
 * @param name The _unique_ name of the resulting resource.
 */
public fun disk(name: String): Disk {
    val builder = DiskResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy