com.pulumi.gcp.filestore.kotlin.Snapshot.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.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
© 2015 - 2024 Weber Informatics LLC | Privacy Policy