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

com.pulumi.gcp.filestore.kotlin.BackupArgs.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.filestore.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.filestore.BackupArgs.builder
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * A Google Cloud Filestore backup.
 * To get more information about Backup, see:
 * * [API documentation](https://cloud.google.com/filestore/docs/reference/rest/v1/projects.locations.instances.backups)
 * * How-to Guides
 *     * [Creating Backups](https://cloud.google.com/filestore/docs/create-backups)
 *     * [Official Documentation](https://cloud.google.com/filestore/docs/backups)
 * ## Example Usage
 * ### Filestore Backup Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const instance = new gcp.filestore.Instance("instance", {
 *     name: "tf-fs-inst",
 *     location: "us-central1-b",
 *     tier: "BASIC_HDD",
 *     fileShares: {
 *         capacityGb: 1024,
 *         name: "share1",
 *     },
 *     networks: [{
 *         network: "default",
 *         modes: ["MODE_IPV4"],
 *         connectMode: "DIRECT_PEERING",
 *     }],
 * });
 * const backup = new gcp.filestore.Backup("backup", {
 *     name: "tf-fs-bkup",
 *     location: "us-central1",
 *     description: "This is a filestore backup for the test instance",
 *     sourceInstance: instance.id,
 *     sourceFileShare: "share1",
 *     labels: {
 *         files: "label1",
 *         "other-label": "label2",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * instance = gcp.filestore.Instance("instance",
 *     name="tf-fs-inst",
 *     location="us-central1-b",
 *     tier="BASIC_HDD",
 *     file_shares={
 *         "capacity_gb": 1024,
 *         "name": "share1",
 *     },
 *     networks=[{
 *         "network": "default",
 *         "modes": ["MODE_IPV4"],
 *         "connect_mode": "DIRECT_PEERING",
 *     }])
 * backup = gcp.filestore.Backup("backup",
 *     name="tf-fs-bkup",
 *     location="us-central1",
 *     description="This is a filestore backup for the test instance",
 *     source_instance=instance.id,
 *     source_file_share="share1",
 *     labels={
 *         "files": "label1",
 *         "other-label": "label2",
 *     })
 * ```
 * ```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 = "tf-fs-inst",
 *         Location = "us-central1-b",
 *         Tier = "BASIC_HDD",
 *         FileShares = new Gcp.Filestore.Inputs.InstanceFileSharesArgs
 *         {
 *             CapacityGb = 1024,
 *             Name = "share1",
 *         },
 *         Networks = new[]
 *         {
 *             new Gcp.Filestore.Inputs.InstanceNetworkArgs
 *             {
 *                 Network = "default",
 *                 Modes = new[]
 *                 {
 *                     "MODE_IPV4",
 *                 },
 *                 ConnectMode = "DIRECT_PEERING",
 *             },
 *         },
 *     });
 *     var backup = new Gcp.Filestore.Backup("backup", new()
 *     {
 *         Name = "tf-fs-bkup",
 *         Location = "us-central1",
 *         Description = "This is a filestore backup for the test instance",
 *         SourceInstance = instance.Id,
 *         SourceFileShare = "share1",
 *         Labels =
 *         {
 *             { "files", "label1" },
 *             { "other-label", "label2" },
 *         },
 *     });
 * });
 * ```
 * ```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("tf-fs-inst"),
 * 			Location: pulumi.String("us-central1-b"),
 * 			Tier:     pulumi.String("BASIC_HDD"),
 * 			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"),
 * 					},
 * 					ConnectMode: pulumi.String("DIRECT_PEERING"),
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = filestore.NewBackup(ctx, "backup", &filestore.BackupArgs{
 * 			Name:            pulumi.String("tf-fs-bkup"),
 * 			Location:        pulumi.String("us-central1"),
 * 			Description:     pulumi.String("This is a filestore backup for the test instance"),
 * 			SourceInstance:  instance.ID(),
 * 			SourceFileShare: pulumi.String("share1"),
 * 			Labels: pulumi.StringMap{
 * 				"files":       pulumi.String("label1"),
 * 				"other-label": pulumi.String("label2"),
 * 			},
 * 		})
 * 		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.Backup;
 * import com.pulumi.gcp.filestore.BackupArgs;
 * 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("tf-fs-inst")
 *             .location("us-central1-b")
 *             .tier("BASIC_HDD")
 *             .fileShares(InstanceFileSharesArgs.builder()
 *                 .capacityGb(1024)
 *                 .name("share1")
 *                 .build())
 *             .networks(InstanceNetworkArgs.builder()
 *                 .network("default")
 *                 .modes("MODE_IPV4")
 *                 .connectMode("DIRECT_PEERING")
 *                 .build())
 *             .build());
 *         var backup = new Backup("backup", BackupArgs.builder()
 *             .name("tf-fs-bkup")
 *             .location("us-central1")
 *             .description("This is a filestore backup for the test instance")
 *             .sourceInstance(instance.id())
 *             .sourceFileShare("share1")
 *             .labels(Map.ofEntries(
 *                 Map.entry("files", "label1"),
 *                 Map.entry("other-label", "label2")
 *             ))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   instance:
 *     type: gcp:filestore:Instance
 *     properties:
 *       name: tf-fs-inst
 *       location: us-central1-b
 *       tier: BASIC_HDD
 *       fileShares:
 *         capacityGb: 1024
 *         name: share1
 *       networks:
 *         - network: default
 *           modes:
 *             - MODE_IPV4
 *           connectMode: DIRECT_PEERING
 *   backup:
 *     type: gcp:filestore:Backup
 *     properties:
 *       name: tf-fs-bkup
 *       location: us-central1
 *       description: This is a filestore backup for the test instance
 *       sourceInstance: ${instance.id}
 *       sourceFileShare: share1
 *       labels:
 *         files: label1
 *         other-label: label2
 * ```
 * 
 * ## Import
 * Backup can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/backups/{{name}}`
 * * `{{project}}/{{location}}/{{name}}`
 * * `{{location}}/{{name}}`
 * When using the `pulumi import` command, Backup can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:filestore/backup:Backup default projects/{{project}}/locations/{{location}}/backups/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:filestore/backup:Backup default {{project}}/{{location}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:filestore/backup:Backup default {{location}}/{{name}}
 * ```
 * @property description A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
 * @property labels 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.
 * @property location The name of the location of the instance. This can be a region for ENTERPRISE tier instances.
 * - - -
 * @property name The resource name of the backup. 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.
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property sourceFileShare Name of the file share in the source Cloud Filestore instance that the backup is created from.
 * @property sourceInstance The resource name of the source Cloud Filestore instance, in the format projects/{projectId}/locations/{locationId}/instances/{instanceId}, used to create this backup.
 */
public data class BackupArgs(
    public val description: Output? = null,
    public val labels: Output>? = null,
    public val location: Output? = null,
    public val name: Output? = null,
    public val project: Output? = null,
    public val sourceFileShare: Output? = null,
    public val sourceInstance: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.filestore.BackupArgs =
        com.pulumi.gcp.filestore.BackupArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .labels(labels?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .location(location?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .project(project?.applyValue({ args0 -> args0 }))
            .sourceFileShare(sourceFileShare?.applyValue({ args0 -> args0 }))
            .sourceInstance(sourceInstance?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [BackupArgs].
 */
@PulumiTagMarker
public class BackupArgsBuilder internal constructor() {
    private var description: Output? = null

    private var labels: Output>? = null

    private var location: Output? = null

    private var name: Output? = null

    private var project: Output? = null

    private var sourceFileShare: Output? = null

    private var sourceInstance: Output? = null

    /**
     * @param value A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
     */
    @JvmName("iyguriryfysqdxey")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value 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.
     */
    @JvmName("ownpigylscroxsnb")
    public suspend fun labels(`value`: Output>) {
        this.labels = value
    }

    /**
     * @param value The name of the location of the instance. This can be a region for ENTERPRISE tier instances.
     * - - -
     */
    @JvmName("xqspwjslupvtxmsb")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value The resource name of the backup. 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.
     */
    @JvmName("vhpoogxhrclsylqd")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("htdmgqwlvqodoowr")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value Name of the file share in the source Cloud Filestore instance that the backup is created from.
     */
    @JvmName("rocnnlhchbmxfrnc")
    public suspend fun sourceFileShare(`value`: Output) {
        this.sourceFileShare = value
    }

    /**
     * @param value The resource name of the source Cloud Filestore instance, in the format projects/{projectId}/locations/{locationId}/instances/{instanceId}, used to create this backup.
     */
    @JvmName("oyxujtjcbgcyoxnn")
    public suspend fun sourceInstance(`value`: Output) {
        this.sourceInstance = value
    }

    /**
     * @param value A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
     */
    @JvmName("dybmxmjnhqjedjal")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value 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.
     */
    @JvmName("qvsajiauidpsdonn")
    public suspend fun labels(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param values 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.
     */
    @JvmName("flilunbwipoqcajs")
    public fun labels(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.labels = mapped
    }

    /**
     * @param value The name of the location of the instance. This can be a region for ENTERPRISE tier instances.
     * - - -
     */
    @JvmName("qwwafprbrrtwqcyw")
    public suspend fun location(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.location = mapped
    }

    /**
     * @param value The resource name of the backup. 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.
     */
    @JvmName("tpowlkpqfrqcmlgn")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     */
    @JvmName("bngrdxcjkrndpmsj")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value Name of the file share in the source Cloud Filestore instance that the backup is created from.
     */
    @JvmName("drokvxxwfndqygvj")
    public suspend fun sourceFileShare(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceFileShare = mapped
    }

    /**
     * @param value The resource name of the source Cloud Filestore instance, in the format projects/{projectId}/locations/{locationId}/instances/{instanceId}, used to create this backup.
     */
    @JvmName("monfxgmqidlxwgpn")
    public suspend fun sourceInstance(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceInstance = mapped
    }

    internal fun build(): BackupArgs = BackupArgs(
        description = description,
        labels = labels,
        location = location,
        name = name,
        project = project,
        sourceFileShare = sourceFileShare,
        sourceInstance = sourceInstance,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy