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

com.pulumi.gcp.netapp.kotlin.BackupArgs.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.13.1.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.netapp.kotlin

import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.gcp.netapp.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

/**
 * NetApp Volumes supports volume backups, which are copies of your volumes
 * stored independently from the volume. Backups are stored in backup vaults,
 * which are containers for backups. If a volume is lost or deleted, you can
 * use backups to restore your data to a new volume.
 * When you create the first backup of a volume, all of the volume's used
 * data is sent to the backup vault. Subsequent backups of the same volume
 * only include data that has changed from the previous backup. This allows
 * for fast incremental-forever backups and reduces the required capacity
 * inside the backup vault.
 * You can create manual and scheduled backups. Manual backups can be taken
 * from a volume or from an existing volume snapshot. Scheduled backups
 * require a backup policy.
 * To get more information about Backup, see:
 * * [API documentation](https://cloud.google.com/netapp/volumes/docs/reference/rest/v1/projects.locations.backupVaults.backups)
 * * How-to Guides
 *     * [Documentation](https://cloud.google.com/netapp/volumes/docs/protect-data/about-volume-backups)
 * ## Example Usage
 * ### Netapp Backup
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const default = gcp.compute.getNetwork({
 *     name: "",
 * });
 * const defaultStoragePool = new gcp.netapp.StoragePool("default", {
 *     name: "backup-pool",
 *     location: "us-central1",
 *     serviceLevel: "PREMIUM",
 *     capacityGib: "2048",
 *     network: _default.then(_default => _default.id),
 * });
 * const defaultBackupVault = new gcp.netapp.BackupVault("default", {
 *     name: "backup-vault",
 *     location: defaultStoragePool.location,
 * });
 * const defaultVolume = new gcp.netapp.Volume("default", {
 *     name: "backup-volume",
 *     location: defaultStoragePool.location,
 *     capacityGib: "100",
 *     shareName: "backup-volume",
 *     storagePool: defaultStoragePool.name,
 *     protocols: ["NFSV3"],
 *     deletionPolicy: "FORCE",
 *     backupConfig: {
 *         backupVault: defaultBackupVault.id,
 *     },
 * });
 * const testBackup = new gcp.netapp.Backup("test_backup", {
 *     name: "test-backup",
 *     location: defaultBackupVault.location,
 *     vaultName: defaultBackupVault.name,
 *     sourceVolume: defaultVolume.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default = gcp.compute.get_network(name="")
 * default_storage_pool = gcp.netapp.StoragePool("default",
 *     name="backup-pool",
 *     location="us-central1",
 *     service_level="PREMIUM",
 *     capacity_gib="2048",
 *     network=default.id)
 * default_backup_vault = gcp.netapp.BackupVault("default",
 *     name="backup-vault",
 *     location=default_storage_pool.location)
 * default_volume = gcp.netapp.Volume("default",
 *     name="backup-volume",
 *     location=default_storage_pool.location,
 *     capacity_gib="100",
 *     share_name="backup-volume",
 *     storage_pool=default_storage_pool.name,
 *     protocols=["NFSV3"],
 *     deletion_policy="FORCE",
 *     backup_config={
 *         "backup_vault": default_backup_vault.id,
 *     })
 * test_backup = gcp.netapp.Backup("test_backup",
 *     name="test-backup",
 *     location=default_backup_vault.location,
 *     vault_name=default_backup_vault.name,
 *     source_volume=default_volume.id)
 * ```
 * ```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 = "",
 *     });
 *     var defaultStoragePool = new Gcp.Netapp.StoragePool("default", new()
 *     {
 *         Name = "backup-pool",
 *         Location = "us-central1",
 *         ServiceLevel = "PREMIUM",
 *         CapacityGib = "2048",
 *         Network = @default.Apply(@default => @default.Apply(getNetworkResult => getNetworkResult.Id)),
 *     });
 *     var defaultBackupVault = new Gcp.Netapp.BackupVault("default", new()
 *     {
 *         Name = "backup-vault",
 *         Location = defaultStoragePool.Location,
 *     });
 *     var defaultVolume = new Gcp.Netapp.Volume("default", new()
 *     {
 *         Name = "backup-volume",
 *         Location = defaultStoragePool.Location,
 *         CapacityGib = "100",
 *         ShareName = "backup-volume",
 *         StoragePool = defaultStoragePool.Name,
 *         Protocols = new[]
 *         {
 *             "NFSV3",
 *         },
 *         DeletionPolicy = "FORCE",
 *         BackupConfig = new Gcp.Netapp.Inputs.VolumeBackupConfigArgs
 *         {
 *             BackupVault = defaultBackupVault.Id,
 *         },
 *     });
 *     var testBackup = new Gcp.Netapp.Backup("test_backup", new()
 *     {
 *         Name = "test-backup",
 *         Location = defaultBackupVault.Location,
 *         VaultName = defaultBackupVault.Name,
 *         SourceVolume = defaultVolume.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v8/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: "",
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultStoragePool, err := netapp.NewStoragePool(ctx, "default", &netapp.StoragePoolArgs{
 * 			Name:         pulumi.String("backup-pool"),
 * 			Location:     pulumi.String("us-central1"),
 * 			ServiceLevel: pulumi.String("PREMIUM"),
 * 			CapacityGib:  pulumi.String("2048"),
 * 			Network:      pulumi.String(_default.Id),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultBackupVault, err := netapp.NewBackupVault(ctx, "default", &netapp.BackupVaultArgs{
 * 			Name:     pulumi.String("backup-vault"),
 * 			Location: defaultStoragePool.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultVolume, err := netapp.NewVolume(ctx, "default", &netapp.VolumeArgs{
 * 			Name:        pulumi.String("backup-volume"),
 * 			Location:    defaultStoragePool.Location,
 * 			CapacityGib: pulumi.String("100"),
 * 			ShareName:   pulumi.String("backup-volume"),
 * 			StoragePool: defaultStoragePool.Name,
 * 			Protocols: pulumi.StringArray{
 * 				pulumi.String("NFSV3"),
 * 			},
 * 			DeletionPolicy: pulumi.String("FORCE"),
 * 			BackupConfig: &netapp.VolumeBackupConfigArgs{
 * 				BackupVault: defaultBackupVault.ID(),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = netapp.NewBackup(ctx, "test_backup", &netapp.BackupArgs{
 * 			Name:         pulumi.String("test-backup"),
 * 			Location:     defaultBackupVault.Location,
 * 			VaultName:    defaultBackupVault.Name,
 * 			SourceVolume: defaultVolume.ID(),
 * 		})
 * 		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.BackupVault;
 * import com.pulumi.gcp.netapp.BackupVaultArgs;
 * import com.pulumi.gcp.netapp.Volume;
 * import com.pulumi.gcp.netapp.VolumeArgs;
 * import com.pulumi.gcp.netapp.inputs.VolumeBackupConfigArgs;
 * import com.pulumi.gcp.netapp.Backup;
 * import com.pulumi.gcp.netapp.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) {
 *         final var default = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
 *             .name("")
 *             .build());
 *         var defaultStoragePool = new StoragePool("defaultStoragePool", StoragePoolArgs.builder()
 *             .name("backup-pool")
 *             .location("us-central1")
 *             .serviceLevel("PREMIUM")
 *             .capacityGib("2048")
 *             .network(default_.id())
 *             .build());
 *         var defaultBackupVault = new BackupVault("defaultBackupVault", BackupVaultArgs.builder()
 *             .name("backup-vault")
 *             .location(defaultStoragePool.location())
 *             .build());
 *         var defaultVolume = new Volume("defaultVolume", VolumeArgs.builder()
 *             .name("backup-volume")
 *             .location(defaultStoragePool.location())
 *             .capacityGib("100")
 *             .shareName("backup-volume")
 *             .storagePool(defaultStoragePool.name())
 *             .protocols("NFSV3")
 *             .deletionPolicy("FORCE")
 *             .backupConfig(VolumeBackupConfigArgs.builder()
 *                 .backupVault(defaultBackupVault.id())
 *                 .build())
 *             .build());
 *         var testBackup = new Backup("testBackup", BackupArgs.builder()
 *             .name("test-backup")
 *             .location(defaultBackupVault.location())
 *             .vaultName(defaultBackupVault.name())
 *             .sourceVolume(defaultVolume.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   defaultStoragePool:
 *     type: gcp:netapp:StoragePool
 *     name: default
 *     properties:
 *       name: backup-pool
 *       location: us-central1
 *       serviceLevel: PREMIUM
 *       capacityGib: '2048'
 *       network: ${default.id}
 *   defaultVolume:
 *     type: gcp:netapp:Volume
 *     name: default
 *     properties:
 *       name: backup-volume
 *       location: ${defaultStoragePool.location}
 *       capacityGib: '100'
 *       shareName: backup-volume
 *       storagePool: ${defaultStoragePool.name}
 *       protocols:
 *         - NFSV3
 *       deletionPolicy: FORCE
 *       backupConfig:
 *         backupVault: ${defaultBackupVault.id}
 *   defaultBackupVault:
 *     type: gcp:netapp:BackupVault
 *     name: default
 *     properties:
 *       name: backup-vault
 *       location: ${defaultStoragePool.location}
 *   testBackup:
 *     type: gcp:netapp:Backup
 *     name: test_backup
 *     properties:
 *       name: test-backup
 *       location: ${defaultBackupVault.location}
 *       vaultName: ${defaultBackupVault.name}
 *       sourceVolume: ${defaultVolume.id}
 * variables:
 *   default:
 *     fn::invoke:
 *       function: gcp:compute:getNetwork
 *       arguments:
 *         name: ""
 * ```
 * 
 * ## Import
 * Backup can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/{{location}}/backupVaults/{{vault_name}}/backups/{{name}}`
 * * `{{project}}/{{location}}/{{vault_name}}/{{name}}`
 * * `{{location}}/{{vault_name}}/{{name}}`
 * When using the `pulumi import` command, Backup can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:netapp/backup:Backup default projects/{{project}}/locations/{{location}}/backupVaults/{{vault_name}}/backups/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/backup:Backup default {{project}}/{{location}}/{{vault_name}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:netapp/backup:Backup default {{location}}/{{vault_name}}/{{name}}
 * ```
 * @property description A description of the backup with 2048 characters or less. Requests with longer descriptions will be rejected.
 * @property labels 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.
 * @property location Location of the backup.
 * @property name The resource name of the backup. Needs to be unique per location.
 * - - -
 * @property project The ID of the project in which the resource belongs.
 * If it is not provided, the provider project is used.
 * @property sourceSnapshot If specified, backup will be created from the given snapshot. If not specified,
 * there will be a new snapshot taken to initiate the backup creation.
 * Format: `projects/{{projectId}}/locations/{{location}}/volumes/{{volumename}}/snapshots/{{snapshotname}}``
 * @property sourceVolume ID of volumes this backup belongs to. Format: `projects/{{projects_id}}/locations/{{location}}/volumes/{{name}}``
 * @property vaultName Name of the backup vault to store the backup in.
 */
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 sourceSnapshot: Output? = null,
    public val sourceVolume: Output? = null,
    public val vaultName: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.gcp.netapp.BackupArgs =
        com.pulumi.gcp.netapp.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 }))
            .sourceSnapshot(sourceSnapshot?.applyValue({ args0 -> args0 }))
            .sourceVolume(sourceVolume?.applyValue({ args0 -> args0 }))
            .vaultName(vaultName?.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 sourceSnapshot: Output? = null

    private var sourceVolume: Output? = null

    private var vaultName: Output? = null

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

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

    /**
     * @param value Location of the backup.
     */
    @JvmName("crllhuhibuylwdqq")
    public suspend fun location(`value`: Output) {
        this.location = value
    }

    /**
     * @param value The resource name of the backup. Needs to be unique per location.
     * - - -
     */
    @JvmName("wpbcqjnhaxwbuksf")
    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("suljbmhcfguijwuf")
    public suspend fun project(`value`: Output) {
        this.project = value
    }

    /**
     * @param value If specified, backup will be created from the given snapshot. If not specified,
     * there will be a new snapshot taken to initiate the backup creation.
     * Format: `projects/{{projectId}}/locations/{{location}}/volumes/{{volumename}}/snapshots/{{snapshotname}}``
     */
    @JvmName("vlwgeixqyefndtdv")
    public suspend fun sourceSnapshot(`value`: Output) {
        this.sourceSnapshot = value
    }

    /**
     * @param value ID of volumes this backup belongs to. Format: `projects/{{projects_id}}/locations/{{location}}/volumes/{{name}}``
     */
    @JvmName("xjopesbnpgudxyew")
    public suspend fun sourceVolume(`value`: Output) {
        this.sourceVolume = value
    }

    /**
     * @param value Name of the backup vault to store the backup in.
     */
    @JvmName("ikagnevrgnpvrhum")
    public suspend fun vaultName(`value`: Output) {
        this.vaultName = value
    }

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

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

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

    /**
     * @param value Location of the backup.
     */
    @JvmName("xhhxkotkekggsriw")
    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. Needs to be unique per location.
     * - - -
     */
    @JvmName("wkhuwypvcbpnqdxy")
    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("dcdxlghemotrnghp")
    public suspend fun project(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.project = mapped
    }

    /**
     * @param value If specified, backup will be created from the given snapshot. If not specified,
     * there will be a new snapshot taken to initiate the backup creation.
     * Format: `projects/{{projectId}}/locations/{{location}}/volumes/{{volumename}}/snapshots/{{snapshotname}}``
     */
    @JvmName("owpthnjtcmkcsysw")
    public suspend fun sourceSnapshot(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceSnapshot = mapped
    }

    /**
     * @param value ID of volumes this backup belongs to. Format: `projects/{{projects_id}}/locations/{{location}}/volumes/{{name}}``
     */
    @JvmName("rrebkpqeurqgcuga")
    public suspend fun sourceVolume(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceVolume = mapped
    }

    /**
     * @param value Name of the backup vault to store the backup in.
     */
    @JvmName("nlncpddikhdwsscw")
    public suspend fun vaultName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.vaultName = mapped
    }

    internal fun build(): BackupArgs = BackupArgs(
        description = description,
        labels = labels,
        location = location,
        name = name,
        project = project,
        sourceSnapshot = sourceSnapshot,
        sourceVolume = sourceVolume,
        vaultName = vaultName,
    )
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy