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

com.pulumi.gcp.netapp.kotlin.Volume.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.netapp.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeExportPolicy
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeMountOption
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeRestoreParameters
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeSnapshotPolicy
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.List
import kotlin.collections.Map
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeExportPolicy.Companion.toKotlin as volumeExportPolicyToKotlin
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeMountOption.Companion.toKotlin as volumeMountOptionToKotlin
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeRestoreParameters.Companion.toKotlin as volumeRestoreParametersToKotlin
import com.pulumi.gcp.netapp.kotlin.outputs.VolumeSnapshotPolicy.Companion.toKotlin as volumeSnapshotPolicyToKotlin

/**
 * 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.gcp.netapp.Volume(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Volume(builtJavaResource)
    }
}

/**
 * A volume is a file system container in a storage pool that stores application, database, and user data.
 * You can create a volume's capacity using the available capacity in the storage pool and you can define and resize the capacity without disruption to any processes.
 * Storage pool settings apply to the volumes contained within them automatically.
 * To get more information about Volume, see:
 * * [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.volumes)
 * * How-to Guides
 *     * [Quickstart](https://cloud.google.com/netapp/volumes/docs/get-started/quickstarts/create-volume)
 *     * [Documentation](https://cloud.google.com/netapp/volumes/docs/configure-and-use/volumes/overview)
 * ## Example Usage
 * ### Netapp Volume Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const default = gcp.compute.getNetwork({
 *     name: "test-network",
 * });
 * const defaultStoragePool = new gcp.netapp.StoragePool("default", {
 *     name: "test-pool",
 *     location: "us-west2",
 *     serviceLevel: "PREMIUM",
 *     capacityGib: "2048",
 *     network: _default.then(_default => _default.id),
 * });
 * const testVolume = new gcp.netapp.Volume("test_volume", {
 *     location: "us-west2",
 *     name: "test-volume",
 *     capacityGib: "100",
 *     shareName: "test-volume",
 *     storagePool: defaultStoragePool.name,
 *     protocols: ["NFSV3"],
 *     deletionPolicy: "DEFAULT",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.get_network(name="test-network")
 * default_storage_pool = gcp.netapp.StoragePool("default",
 *     name="test-pool",
 *     location="us-west2",
 *     service_level="PREMIUM",
 *     capacity_gib="2048",
 *     network=default.id)
 * test_volume = gcp.netapp.Volume("test_volume",
 *     location="us-west2",
 *     name="test-volume",
 *     capacity_gib="100",
 *     share_name="test-volume",
 *     storage_pool=default_storage_pool.name,
 *     protocols=["NFSV3"],
 *     deletion_policy="DEFAULT")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = Gcp.Compute.GetNetwork.Invoke(new()
 *     {
 *         Name = "test-network",
 *     });
 *     var defaultStoragePool = new Gcp.Netapp.StoragePool("default", new()
 *     {
 *         Name = "test-pool",
 *         Location = "us-west2",
 *         ServiceLevel = "PREMIUM",
 *         CapacityGib = "2048",
 *         Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
 *     });
 *     var testVolume = new Gcp.Netapp.Volume("test_volume", new()
 *     {
 *         Location = "us-west2",
 *         Name = "test-volume",
 *         CapacityGib = "100",
 *         ShareName = "test-volume",
 *         StoragePool = defaultStoragePool.Name,
 *         Protocols = new[]
 *         {
 *             "NFSV3",
 *         },
 *         DeletionPolicy = "DEFAULT",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/netapp"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_default, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
 * 			Name: "test-network",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultStoragePool, err := netapp.NewStoragePool(ctx, "default", &netapp.StoragePoolArgs{
 * 			Name:         pulumi.String("test-pool"),
 * 			Location:     pulumi.String("us-west2"),
 * 			ServiceLevel: pulumi.String("PREMIUM"),
 * 			CapacityGib:  pulumi.String("2048"),
 * 			Network:      pulumi.String(_default.Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = netapp.NewVolume(ctx, "test_volume", &netapp.VolumeArgs{
 * 			Location:    pulumi.String("us-west2"),
 * 			Name:        pulumi.String("test-volume"),
 * 			CapacityGib: pulumi.String("100"),
 * 			ShareName:   pulumi.String("test-volume"),
 * 			StoragePool: defaultStoragePool.Name,
 * 			Protocols: pulumi.StringArray{
 * 				pulumi.String("NFSV3"),
 * 			},
 * 			DeletionPolicy: pulumi.String("DEFAULT"),
 * 		})
 * 		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.ComputeFunctions;
 * import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
 * import com.pulumi.gcp.netapp.StoragePool;
 * import com.pulumi.gcp.netapp.StoragePoolArgs;
 * import com.pulumi.gcp.netapp.Volume;
 * import com.pulumi.gcp.netapp.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 default = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
 *             .name("test-network")
 *             .build());
 *         var defaultStoragePool = new StoragePool("defaultStoragePool", StoragePoolArgs.builder()
 *             .name("test-pool")
 *             .location("us-west2")
 *             .serviceLevel("PREMIUM")
 *             .capacityGib("2048")
 *             .network(default_.id())
 *             .build());
 *         var testVolume = new Volume("testVolume", VolumeArgs.builder()
 *             .location("us-west2")
 *             .name("test-volume")
 *             .capacityGib("100")
 *             .shareName("test-volume")
 *             .storagePool(defaultStoragePool.name())
 *             .protocols("NFSV3")
 *             .deletionPolicy("DEFAULT")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   defaultStoragePool:
 *     type: gcp:netapp:StoragePool
 *     name: default
 *     properties:
 *       name: test-pool
 *       location: us-west2
 *       serviceLevel: PREMIUM
 *       capacityGib: '2048'
 *       network: ${default.id}
 *   testVolume:
 *     type: gcp:netapp:Volume
 *     name: test_volume
 *     properties:
 *       location: us-west2
 *       name: test-volume
 *       capacityGib: '100'
 *       shareName: test-volume
 *       storagePool: ${defaultStoragePool.name}
 *       protocols:
 *         - NFSV3
 *       deletionPolicy: DEFAULT
 * variables:
 *   default:
 *     fn::invoke:
 *       Function: gcp:compute:getNetwork
 *       Arguments:
 *         name: test-network
 * ```
 * 
 * ## Import
 * Volume can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/volumes/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Volume can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:netapp/volume:Volume default projects/{{project}}/locations/{{location}}/volumes/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/volume:Volume default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/volume:Volume default {{location}}/{{name}}
 * ```
 */
public class Volume internal constructor(
    override val javaResource: com.pulumi.gcp.netapp.Volume,
) : KotlinCustomResource(javaResource, VolumeMapper) {
    /**
     * Reports the resource name of the Active Directory policy being used. Inherited from storage pool.
     */
    public val activeDirectory: Output
        get() = javaResource.activeDirectory().applyValue({ args0 -> args0 })

    /**
     * Capacity of the volume (in GiB).
     */
    public val capacityGib: Output
        get() = javaResource.capacityGib().applyValue({ args0 -> args0 })

    /**
     * Create time of the volume. A timestamp in RFC3339 UTC "Zulu" format. Examples: "2023-06-22T09:13:01.617Z".
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * Policy to determine if the volume should be deleted forcefully.
     * Volumes may have nested snapshot resources. Deleting such a volume will fail.
     * Setting this parameter to FORCE will delete volumes including nested snapshots.
     */
    public val deletionPolicy: Output?
        get() = javaResource.deletionPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * An optional description of this resource.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * 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()
        })

    /**
     * Reports the data-at-rest encryption type of the volume. Inherited from storage pool.
     */
    public val encryptionType: Output
        get() = javaResource.encryptionType().applyValue({ args0 -> args0 })

    /**
     * Export policy of the volume for NFSV3 and/or NFSV4.1 access.
     * Structure is documented below.
     */
    public val exportPolicy: Output?
        get() = javaResource.exportPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    volumeExportPolicyToKotlin(args0)
                })
            }).orElse(null)
        })

    /**
     * Indicates whether the volume is part of a volume replication relationship.
     */
    public val hasReplication: Output
        get() = javaResource.hasReplication().applyValue({ args0 -> args0 })

    /**
     * Flag indicating if the volume is a kerberos volume or not, export policy rules control kerberos security modes (krb5, krb5i, krb5p).
     */
    public val kerberosEnabled: Output?
        get() = javaResource.kerberosEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Reports the CMEK policy resurce name being used for volume encryption. Inherited from storage pool.
     */
    public val kmsConfig: Output
        get() = javaResource.kmsConfig().applyValue({ args0 -> args0 })

    /**
     * Labels as key value pairs. Example: `{ "owner": "Bob", "department": "finance", "purpose": "testing" }`.
     * **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)
        })

    /**
     * Flag indicating if the volume is NFS LDAP enabled or not. Inherited from storage pool.
     */
    public val ldapEnabled: Output
        get() = javaResource.ldapEnabled().applyValue({ args0 -> args0 })

    /**
     * Name of the pool location. Usually a region name, expect for some STANDARD service level pools which require a zone name.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Reports mount instructions for this volume.
     * Structure is documented below.
     */
    public val mountOptions: Output>
        get() = javaResource.mountOptions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    volumeMountOptionToKotlin(args0)
                })
            })
        })

    /**
     * The name of the volume. Needs to be unique per location.
     * - - -
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * VPC network name with format: `projects/{{project}}/global/networks/{{network}}`. Inherited from storage pool.
     */
    public val network: Output
        get() = javaResource.network().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 })

    /**
     * The protocol of the volume. Allowed combinations are `['NFSV3']`, `['NFSV4']`, `['SMB']`, `['NFSV3', 'NFSV4']`, `['SMB', 'NFSV3']` and `['SMB', 'NFSV4']`.
     * Each value may be one of: `NFSV3`, `NFSV4`, `SMB`.
     */
    public val protocols: Output>
        get() = javaResource.protocols().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * Name of the Private Service Access allocated range. Inherited from storage pool.
     */
    public val psaRange: Output
        get() = javaResource.psaRange().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()
        })

    /**
     * Used to create this volume from a snapshot (= cloning) or an backup.
     * Structure is documented below.
     */
    public val restoreParameters: Output?
        get() = javaResource.restoreParameters().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> volumeRestoreParametersToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * List of actions that are restricted on this volume.
     * Each value may be one of: `DELETE`.
     */
    public val restrictedActions: Output>?
        get() = javaResource.restrictedActions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 -> args0 })
            }).orElse(null)
        })

    /**
     * Security Style of the Volume. Use UNIX to use UNIX or NFSV4 ACLs for file permissions.
     * Use NTFS to use NTFS ACLs for file permissions. Can only be set for volumes which use SMB together with NFS as protocol.
     * Possible values are: `NTFS`, `UNIX`.
     */
    public val securityStyle: Output
        get() = javaResource.securityStyle().applyValue({ args0 -> args0 })

    /**
     * Service level of the volume. Inherited from storage pool. Supported values are : PREMIUM, EXTERME, STANDARD, FLEX.
     */
    public val serviceLevel: Output
        get() = javaResource.serviceLevel().applyValue({ args0 -> args0 })

    /**
     * Share name (SMB) or export path (NFS) of the volume. Needs to be unique per location.
     */
    public val shareName: Output
        get() = javaResource.shareName().applyValue({ args0 -> args0 })

    /**
     * Settings for volumes with SMB access.
     * Each value may be one of: `ENCRYPT_DATA`, `BROWSABLE`, `CHANGE_NOTIFY`, `NON_BROWSABLE`, `OPLOCKS`, `SHOW_SNAPSHOT`, `SHOW_PREVIOUS_VERSIONS`, `ACCESS_BASED_ENUMERATION`, `CONTINUOUSLY_AVAILABLE`.
     */
    public val smbSettings: Output>?
        get() = javaResource.smbSettings().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * If enabled, a NFS volume will contain a read-only .snapshot directory which provides access to each of the volume's snapshots. Will enable "Previous Versions" support for SMB.
     */
    public val snapshotDirectory: Output?
        get() = javaResource.snapshotDirectory().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Snapshot policy defines the schedule for automatic snapshot creation.
     * To disable automatic snapshot creation you have to remove the whole snapshot_policy block.
     * Structure is documented below.
     */
    public val snapshotPolicy: Output?
        get() = javaResource.snapshotPolicy().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> volumeSnapshotPolicyToKotlin(args0) })
            }).orElse(null)
        })

    /**
     * State of the volume.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })

    /**
     * State details of the volume.
     */
    public val stateDetails: Output
        get() = javaResource.stateDetails().applyValue({ args0 -> args0 })

    /**
     * Name of the storage pool to create the volume in. Pool needs enough spare capacity to accomodate the volume.
     */
    public val storagePool: Output
        get() = javaResource.storagePool().applyValue({ args0 -> args0 })

    /**
     * Unix permission the mount point will be created with. Default is 0770. Applicable for UNIX security style volumes only.
     */
    public val unixPermissions: Output
        get() = javaResource.unixPermissions().applyValue({ args0 -> args0 })

    /**
     * Used capacity of the volume (in GiB). This is computed periodically and it does not represent the realtime usage.
     */
    public val usedGib: Output
        get() = javaResource.usedGib().applyValue({ args0 -> args0 })
}

public object VolumeMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.netapp.Volume::class == javaResource::class

    override fun map(javaResource: Resource): Volume = Volume(
        javaResource as
            com.pulumi.gcp.netapp.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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy