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

com.pulumi.gcp.filestore.kotlin.Snapshot.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.filestore.kotlin

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.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map

/**
 * Builder for [Snapshot].
 */
@PulumiTagMarker
public class SnapshotResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: SnapshotArgs = SnapshotArgs()

    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 SnapshotArgsBuilder.() -> Unit) {
        val builder = SnapshotArgsBuilder()
        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(): Snapshot {
        val builtJavaResource = com.pulumi.gcp.filestore.Snapshot(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Snapshot(builtJavaResource)
    }
}

/**
 * A Google Cloud Filestore snapshot.
 * To get more information about Snapshot, see:
 * * [API documentation](https://cloud.google.com/filestore/docs/reference/rest/v1/projects.locations.instances.snapshots)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/filestore/docs/snapshots)
 *     * [Creating Snapshots](https://cloud.google.com/filestore/docs/create-snapshots)
 * ## Example Usage
 * ### Filestore Snapshot Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.filestore.Instance("instance", {
 *     name: "test-instance-for-snapshot",
 *     location: "us-east1",
 *     tier: "ENTERPRISE",
 *     fileShares: {
 *         capacityGb: 1024,
 *         name: "share1",
 *     },
 *     networks: [{
 *         network: "default",
 *         modes: ["MODE_IPV4"],
 *     }],
 * });
 * const snapshot = new gcp.filestore.Snapshot("snapshot", {
 *     name: "test-snapshot",
 *     instance: instance.name,
 *     location: "us-east1",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance-for-snapshot",
 *     location="us-east1",
 *     tier="ENTERPRISE",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=1024,
 *         name="share1",
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *     )])
 * snapshot = gcp.filestore.Snapshot("snapshot",
 *     name="test-snapshot",
 *     instance=instance.name,
 *     location="us-east1")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance-for-snapshot",
 *         Location = "us-east1",
 *         Tier = "ENTERPRISE",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *             },
 *         },
 *     });
 *     var snapshot = new Gcp.Filestore.Snapshot("snapshot", new()
 *     {
 *         Name = "test-snapshot",
 *         Instance = instance.Name,
 *         Location = "us-east1",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		instance, err := filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance-for-snapshot"),
 * 			Location: pulumi.String("us-east1"),
 * 			Tier:     pulumi.String("ENTERPRISE"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(1024),
 * 				Name:       pulumi.String("share1"),
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = filestore.NewSnapshot(ctx, "snapshot", &filestore.SnapshotArgs{
 * 			Name:     pulumi.String("test-snapshot"),
 * 			Instance: instance.Name,
 * 			Location: pulumi.String("us-east1"),
 * 		})
 * 		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.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import com.pulumi.gcp.filestore.Snapshot;
 * import com.pulumi.gcp.filestore.SnapshotArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance-for-snapshot")
 *             .location("us-east1")
 *             .tier("ENTERPRISE")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .build())
 *             .build());
 *         var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
 *             .name("test-snapshot")
 *             .instance(instance.name())
 *             .location("us-east1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   snapshot:
 *     type: gcp:filestore:Snapshot
 *     properties:
 *       name: test-snapshot
 *       instance: ${instance.name}
 *       location: us-east1
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       name: test-instance-for-snapshot
 *       location: us-east1
 *       tier: ENTERPRISE
 *       fileShares:
 *         capacityGb: 1024
 *         name: share1
 *       networks:
 *         - network: default
 *           modes:
 *             - MODE_IPV4
 * ```
 * 
 * ### Filestore Snapshot Full
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.filestore.Instance("instance", {
 *     name: "test-instance-for-snapshot",
 *     location: "us-west1",
 *     tier: "ENTERPRISE",
 *     fileShares: {
 *         capacityGb: 1024,
 *         name: "share1",
 *     },
 *     networks: [{
 *         network: "default",
 *         modes: ["MODE_IPV4"],
 *     }],
 * });
 * const snapshot = new gcp.filestore.Snapshot("snapshot", {
 *     name: "test-snapshot",
 *     instance: instance.name,
 *     location: "us-west1",
 *     description: "Snapshot of test-instance-for-snapshot",
 *     labels: {
 *         my_label: "value",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="test-instance-for-snapshot",
 *     location="us-west1",
 *     tier="ENTERPRISE",
 *     file_shares=gcp.filestore.InstanceFileSharesArgs(
 *         capacity_gb=1024,
 *         name="share1",
 *     ),
 *     networks=[gcp.filestore.InstanceNetworkArgs(
 *         network="default",
 *         modes=["MODE_IPV4"],
 *     )])
 * snapshot = gcp.filestore.Snapshot("snapshot",
 *     name="test-snapshot",
 *     instance=instance.name,
 *     location="us-west1",
 *     description="Snapshot of test-instance-for-snapshot",
 *     labels={
 *         "my_label": "value",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var instance = new Gcp.Filestore.Instance("instance", new()
 *     {
 *         Name = "test-instance-for-snapshot",
 *         Location = "us-west1",
 *         Tier = "ENTERPRISE",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *             },
 *         },
 *     });
 *     var snapshot = new Gcp.Filestore.Snapshot("snapshot", new()
 *     {
 *         Name = "test-snapshot",
 *         Instance = instance.Name,
 *         Location = "us-west1",
 *         Description = "Snapshot of test-instance-for-snapshot",
 *         Labels =
 *         {
 *             { "my_label", "value" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/filestore"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		instance, err := filestore.NewInstance(ctx, "instance", &filestore.InstanceArgs{
 * 			Name:     pulumi.String("test-instance-for-snapshot"),
 * 			Location: pulumi.String("us-west1"),
 * 			Tier:     pulumi.String("ENTERPRISE"),
 * 			FileShares: &filestore.InstanceFileSharesArgs{
 * 				CapacityGb: pulumi.Int(1024),
 * 				Name:       pulumi.String("share1"),
 * 			},
 * 			Networks: filestore.InstanceNetworkArray{
 * 				&filestore.InstanceNetworkArgs{
 * 					Network: pulumi.String("default"),
 * 					Modes: pulumi.StringArray{
 * 						pulumi.String("MODE_IPV4"),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = filestore.NewSnapshot(ctx, "snapshot", &filestore.SnapshotArgs{
 * 			Name:        pulumi.String("test-snapshot"),
 * 			Instance:    instance.Name,
 * 			Location:    pulumi.String("us-west1"),
 * 			Description: pulumi.String("Snapshot of test-instance-for-snapshot"),
 * 			Labels: pulumi.StringMap{
 * 				"my_label": pulumi.String("value"),
 * 			},
 * 		})
 * 		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.filestore.Instance;
 * import com.pulumi.gcp.filestore.InstanceArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceFileSharesArgs;
 * import com.pulumi.gcp.filestore.inputs.InstanceNetworkArgs;
 * import com.pulumi.gcp.filestore.Snapshot;
 * import com.pulumi.gcp.filestore.SnapshotArgs;
 * 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 instance = new Instance("instance", InstanceArgs.builder()
 *             .name("test-instance-for-snapshot")
 *             .location("us-west1")
 *             .tier("ENTERPRISE")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .build())
 *             .build());
 *         var snapshot = new Snapshot("snapshot", SnapshotArgs.builder()
 *             .name("test-snapshot")
 *             .instance(instance.name())
 *             .location("us-west1")
 *             .description("Snapshot of test-instance-for-snapshot")
 *             .labels(Map.of("my_label", "value"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   snapshot:
 *     type: gcp:filestore:Snapshot
 *     properties:
 *       name: test-snapshot
 *       instance: ${instance.name}
 *       location: us-west1
 *       description: Snapshot of test-instance-for-snapshot
 *       labels:
 *         my_label: value
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       name: test-instance-for-snapshot
 *       location: us-west1
 *       tier: ENTERPRISE
 *       fileShares:
 *         capacityGb: 1024
 *         name: share1
 *       networks:
 *         - network: default
 *           modes:
 *             - MODE_IPV4
 * ```
 * 
 * ## Import
 * Snapshot can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/instances/{{instance}}/snapshots/{{name}}`
 * * `{{project}}/{{location}}/{{instance}}/{{name}}`
 * * `{{location}}/{{instance}}/{{name}}`
 * When using the `pulumi import` command, Snapshot can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:filestore/snapshot:Snapshot default projects/{{project}}/locations/{{location}}/instances/{{instance}}/snapshots/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:filestore/snapshot:Snapshot default {{project}}/{{location}}/{{instance}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:filestore/snapshot:Snapshot default {{location}}/{{instance}}/{{name}}
 * ```
 */
public class Snapshot internal constructor(
    override val javaResource: com.pulumi.gcp.filestore.Snapshot,
) : KotlinCustomResource(javaResource, SnapshotMapper) {
    /**
     * The time when the snapshot was created in RFC3339 text format.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A description of the snapshot with 2048 characters or less. Requests with longer descriptions will be rejected.
     */
    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()
        })

    /**
     * The amount of bytes needed to allocate a full copy of the snapshot content.
     */
    public val filesystemUsedBytes: Output
        get() = javaResource.filesystemUsedBytes().applyValue({ args0 -> args0 })

    /**
     * The resource name of the filestore instance.
     * - - -
     */
    public val instance: Output
        get() = javaResource.instance().applyValue({ args0 -> args0 })

    /**
     * Resource labels to represent user-provided metadata.
     * **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)
        })

    /**
     * The name of the location of the instance. This can be a region for ENTERPRISE tier instances.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * The resource name of the snapshot. The name must be unique within the specified instance.
     * 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 })

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

    /**
     * The snapshot state.
     */
    public val state: Output
        get() = javaResource.state().applyValue({ args0 -> args0 })
}

public object SnapshotMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.filestore.Snapshot::class == javaResource::class

    override fun map(javaResource: Resource): Snapshot = Snapshot(
        javaResource as
            com.pulumi.gcp.filestore.Snapshot,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy