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

com.pulumi.azure.backup.kotlin.ProtectedVMArgs.kt Maven / Gradle / Ivy

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

package com.pulumi.azure.backup.kotlin

import com.pulumi.azure.backup.ProtectedVMArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Int
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages Azure Backup for an Azure VM
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "tfex-recovery_vault",
 *     location: "West Europe",
 * });
 * const exampleVault = new azure.recoveryservices.Vault("example", {
 *     name: "tfex-recovery-vault",
 *     location: exampleResourceGroup.location,
 *     resourceGroupName: exampleResourceGroup.name,
 *     sku: "Standard",
 * });
 * const examplePolicyVM = new azure.backup.PolicyVM("example", {
 *     name: "tfex-recovery-vault-policy",
 *     resourceGroupName: exampleResourceGroup.name,
 *     recoveryVaultName: exampleVault.name,
 *     backup: {
 *         frequency: "Daily",
 *         time: "23:00",
 *     },
 *     retentionDaily: {
 *         count: 10,
 *     },
 * });
 * const example = azure.compute.getVirtualMachineOutput({
 *     name: "example-vm",
 *     resourceGroupName: exampleResourceGroup.name,
 * });
 * const vm1 = new azure.backup.ProtectedVM("vm1", {
 *     resourceGroupName: exampleResourceGroup.name,
 *     recoveryVaultName: exampleVault.name,
 *     sourceVmId: example.apply(example => example.id),
 *     backupPolicyId: examplePolicyVM.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="tfex-recovery_vault",
 *     location="West Europe")
 * example_vault = azure.recoveryservices.Vault("example",
 *     name="tfex-recovery-vault",
 *     location=example_resource_group.location,
 *     resource_group_name=example_resource_group.name,
 *     sku="Standard")
 * example_policy_vm = azure.backup.PolicyVM("example",
 *     name="tfex-recovery-vault-policy",
 *     resource_group_name=example_resource_group.name,
 *     recovery_vault_name=example_vault.name,
 *     backup={
 *         "frequency": "Daily",
 *         "time": "23:00",
 *     },
 *     retention_daily={
 *         "count": 10,
 *     })
 * example = azure.compute.get_virtual_machine_output(name="example-vm",
 *     resource_group_name=example_resource_group.name)
 * vm1 = azure.backup.ProtectedVM("vm1",
 *     resource_group_name=example_resource_group.name,
 *     recovery_vault_name=example_vault.name,
 *     source_vm_id=example.id,
 *     backup_policy_id=example_policy_vm.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "tfex-recovery_vault",
 *         Location = "West Europe",
 *     });
 *     var exampleVault = new Azure.RecoveryServices.Vault("example", new()
 *     {
 *         Name = "tfex-recovery-vault",
 *         Location = exampleResourceGroup.Location,
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Sku = "Standard",
 *     });
 *     var examplePolicyVM = new Azure.Backup.PolicyVM("example", new()
 *     {
 *         Name = "tfex-recovery-vault-policy",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         RecoveryVaultName = exampleVault.Name,
 *         Backup = new Azure.Backup.Inputs.PolicyVMBackupArgs
 *         {
 *             Frequency = "Daily",
 *             Time = "23:00",
 *         },
 *         RetentionDaily = new Azure.Backup.Inputs.PolicyVMRetentionDailyArgs
 *         {
 *             Count = 10,
 *         },
 *     });
 *     var example = Azure.Compute.GetVirtualMachine.Invoke(new()
 *     {
 *         Name = "example-vm",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *     });
 *     var vm1 = new Azure.Backup.ProtectedVM("vm1", new()
 *     {
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         RecoveryVaultName = exampleVault.Name,
 *         SourceVmId = example.Apply(getVirtualMachineResult => getVirtualMachineResult.Id),
 *         BackupPolicyId = examplePolicyVM.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/backup"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/recoveryservices"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("tfex-recovery_vault"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVault, err := recoveryservices.NewVault(ctx, "example", &recoveryservices.VaultArgs{
 * 			Name:              pulumi.String("tfex-recovery-vault"),
 * 			Location:          exampleResourceGroup.Location,
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePolicyVM, err := backup.NewPolicyVM(ctx, "example", &backup.PolicyVMArgs{
 * 			Name:              pulumi.String("tfex-recovery-vault-policy"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			RecoveryVaultName: exampleVault.Name,
 * 			Backup: &backup.PolicyVMBackupArgs{
 * 				Frequency: pulumi.String("Daily"),
 * 				Time:      pulumi.String("23:00"),
 * 			},
 * 			RetentionDaily: &backup.PolicyVMRetentionDailyArgs{
 * 				Count: pulumi.Int(10),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example := compute.LookupVirtualMachineOutput(ctx, compute.GetVirtualMachineOutputArgs{
 * 			Name:              pulumi.String("example-vm"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 		}, nil)
 * 		_, err = backup.NewProtectedVM(ctx, "vm1", &backup.ProtectedVMArgs{
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			RecoveryVaultName: exampleVault.Name,
 * 			SourceVmId: pulumi.String(example.ApplyT(func(example compute.GetVirtualMachineResult) (*string, error) {
 * 				return &example.Id, nil
 * 			}).(pulumi.StringPtrOutput)),
 * 			BackupPolicyId: examplePolicyVM.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.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.recoveryservices.Vault;
 * import com.pulumi.azure.recoveryservices.VaultArgs;
 * import com.pulumi.azure.backup.PolicyVM;
 * import com.pulumi.azure.backup.PolicyVMArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMBackupArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMRetentionDailyArgs;
 * import com.pulumi.azure.compute.ComputeFunctions;
 * import com.pulumi.azure.compute.inputs.GetVirtualMachineArgs;
 * import com.pulumi.azure.backup.ProtectedVM;
 * import com.pulumi.azure.backup.ProtectedVMArgs;
 * 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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("tfex-recovery_vault")
 *             .location("West Europe")
 *             .build());
 *         var exampleVault = new Vault("exampleVault", VaultArgs.builder()
 *             .name("tfex-recovery-vault")
 *             .location(exampleResourceGroup.location())
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .sku("Standard")
 *             .build());
 *         var examplePolicyVM = new PolicyVM("examplePolicyVM", PolicyVMArgs.builder()
 *             .name("tfex-recovery-vault-policy")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .recoveryVaultName(exampleVault.name())
 *             .backup(PolicyVMBackupArgs.builder()
 *                 .frequency("Daily")
 *                 .time("23:00")
 *                 .build())
 *             .retentionDaily(PolicyVMRetentionDailyArgs.builder()
 *                 .count(10)
 *                 .build())
 *             .build());
 *         final var example = ComputeFunctions.getVirtualMachine(GetVirtualMachineArgs.builder()
 *             .name("example-vm")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .build());
 *         var vm1 = new ProtectedVM("vm1", ProtectedVMArgs.builder()
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .recoveryVaultName(exampleVault.name())
 *             .sourceVmId(example.applyValue(getVirtualMachineResult -> getVirtualMachineResult).applyValue(example -> example.applyValue(getVirtualMachineResult -> getVirtualMachineResult.id())))
 *             .backupPolicyId(examplePolicyVM.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: tfex-recovery_vault
 *       location: West Europe
 *   exampleVault:
 *     type: azure:recoveryservices:Vault
 *     name: example
 *     properties:
 *       name: tfex-recovery-vault
 *       location: ${exampleResourceGroup.location}
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       sku: Standard
 *   examplePolicyVM:
 *     type: azure:backup:PolicyVM
 *     name: example
 *     properties:
 *       name: tfex-recovery-vault-policy
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       recoveryVaultName: ${exampleVault.name}
 *       backup:
 *         frequency: Daily
 *         time: 23:00
 *       retentionDaily:
 *         count: 10
 *   vm1:
 *     type: azure:backup:ProtectedVM
 *     properties:
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       recoveryVaultName: ${exampleVault.name}
 *       sourceVmId: ${example.id}
 *       backupPolicyId: ${examplePolicyVM.id}
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:compute:getVirtualMachine
 *       Arguments:
 *         name: example-vm
 *         resourceGroupName: ${exampleResourceGroup.name}
 * ```
 * 
 * ## Import
 * Recovery Services Protected VMs can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:backup/protectedVM:ProtectedVM item1 "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupFabrics/Azure/protectionContainers/iaasvmcontainer;iaasvmcontainerv2;group1;vm1/protectedItems/vm;iaasvmcontainerv2;group1;vm1"
 * ```
 * Note the ID requires quoting as there are semicolons
 * @property backupPolicyId Specifies the id of the backup policy to use. Required in creation or when `protection_stopped` is not specified.
 * @property excludeDiskLuns A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection.
 * @property includeDiskLuns A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection.
 * @property protectionState Specifies Protection state of the backup. Possible values are `Invalid`, `IRPending`, `Protected`, `ProtectionStopped`, `ProtectionError` and `ProtectionPaused`.
 * @property recoveryVaultName Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
 * @property resourceGroupName Specifies the name of the Resource Group **associated with** the Recovery Services Vault to use. Changing this forces a new resource to be created.
 * @property sourceVmId Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
 * > **NOTE:** After creation, the `source_vm_id` property can be removed without forcing a new resource to be created; however, setting it to a different ID will create a new resource.
 * This allows the source vm to be deleted without having to remove the backup.
 */
public data class ProtectedVMArgs(
    public val backupPolicyId: Output? = null,
    public val excludeDiskLuns: Output>? = null,
    public val includeDiskLuns: Output>? = null,
    public val protectionState: Output? = null,
    public val recoveryVaultName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val sourceVmId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.backup.ProtectedVMArgs =
        com.pulumi.azure.backup.ProtectedVMArgs.builder()
            .backupPolicyId(backupPolicyId?.applyValue({ args0 -> args0 }))
            .excludeDiskLuns(excludeDiskLuns?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .includeDiskLuns(includeDiskLuns?.applyValue({ args0 -> args0.map({ args0 -> args0 }) }))
            .protectionState(protectionState?.applyValue({ args0 -> args0 }))
            .recoveryVaultName(recoveryVaultName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .sourceVmId(sourceVmId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [ProtectedVMArgs].
 */
@PulumiTagMarker
public class ProtectedVMArgsBuilder internal constructor() {
    private var backupPolicyId: Output? = null

    private var excludeDiskLuns: Output>? = null

    private var includeDiskLuns: Output>? = null

    private var protectionState: Output? = null

    private var recoveryVaultName: Output? = null

    private var resourceGroupName: Output? = null

    private var sourceVmId: Output? = null

    /**
     * @param value Specifies the id of the backup policy to use. Required in creation or when `protection_stopped` is not specified.
     */
    @JvmName("msygusfghllcpmyn")
    public suspend fun backupPolicyId(`value`: Output) {
        this.backupPolicyId = value
    }

    /**
     * @param value A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection.
     */
    @JvmName("tsutkjgapsldhhfr")
    public suspend fun excludeDiskLuns(`value`: Output>) {
        this.excludeDiskLuns = value
    }

    @JvmName("nqyarklpueujladt")
    public suspend fun excludeDiskLuns(vararg values: Output) {
        this.excludeDiskLuns = Output.all(values.asList())
    }

    /**
     * @param values A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection.
     */
    @JvmName("kokpgltqbrbsenvv")
    public suspend fun excludeDiskLuns(values: List>) {
        this.excludeDiskLuns = Output.all(values)
    }

    /**
     * @param value A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection.
     */
    @JvmName("fgsgqbfolusveawa")
    public suspend fun includeDiskLuns(`value`: Output>) {
        this.includeDiskLuns = value
    }

    @JvmName("ybblxnllbfhbwtqf")
    public suspend fun includeDiskLuns(vararg values: Output) {
        this.includeDiskLuns = Output.all(values.asList())
    }

    /**
     * @param values A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection.
     */
    @JvmName("oynbuijcywtibcnd")
    public suspend fun includeDiskLuns(values: List>) {
        this.includeDiskLuns = Output.all(values)
    }

    /**
     * @param value Specifies Protection state of the backup. Possible values are `Invalid`, `IRPending`, `Protected`, `ProtectionStopped`, `ProtectionError` and `ProtectionPaused`.
     */
    @JvmName("lrmakmkmryqnwrkc")
    public suspend fun protectionState(`value`: Output) {
        this.protectionState = value
    }

    /**
     * @param value Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
     */
    @JvmName("kjfcubsulhcbnbbr")
    public suspend fun recoveryVaultName(`value`: Output) {
        this.recoveryVaultName = value
    }

    /**
     * @param value Specifies the name of the Resource Group **associated with** the Recovery Services Vault to use. Changing this forces a new resource to be created.
     */
    @JvmName("peysihypafusvtkq")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
     * > **NOTE:** After creation, the `source_vm_id` property can be removed without forcing a new resource to be created; however, setting it to a different ID will create a new resource.
     * This allows the source vm to be deleted without having to remove the backup.
     */
    @JvmName("sditrwlhcvnabsjo")
    public suspend fun sourceVmId(`value`: Output) {
        this.sourceVmId = value
    }

    /**
     * @param value Specifies the id of the backup policy to use. Required in creation or when `protection_stopped` is not specified.
     */
    @JvmName("jdyuryniwceqnikc")
    public suspend fun backupPolicyId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.backupPolicyId = mapped
    }

    /**
     * @param value A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection.
     */
    @JvmName("ddlvnfpbgftuifqb")
    public suspend fun excludeDiskLuns(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.excludeDiskLuns = mapped
    }

    /**
     * @param values A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection.
     */
    @JvmName("urwvrwufsymmobdl")
    public suspend fun excludeDiskLuns(vararg values: Int) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.excludeDiskLuns = mapped
    }

    /**
     * @param value A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection.
     */
    @JvmName("uvfayxpspuwniurp")
    public suspend fun includeDiskLuns(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.includeDiskLuns = mapped
    }

    /**
     * @param values A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection.
     */
    @JvmName("wslunbhbopdgekrw")
    public suspend fun includeDiskLuns(vararg values: Int) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.includeDiskLuns = mapped
    }

    /**
     * @param value Specifies Protection state of the backup. Possible values are `Invalid`, `IRPending`, `Protected`, `ProtectionStopped`, `ProtectionError` and `ProtectionPaused`.
     */
    @JvmName("omvusxlbiqxhdyvl")
    public suspend fun protectionState(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.protectionState = mapped
    }

    /**
     * @param value Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
     */
    @JvmName("cmumpvefguahhgxh")
    public suspend fun recoveryVaultName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.recoveryVaultName = mapped
    }

    /**
     * @param value Specifies the name of the Resource Group **associated with** the Recovery Services Vault to use. Changing this forces a new resource to be created.
     */
    @JvmName("foyustlroohkxrqa")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value Specifies the ID of the VM to backup. Changing this forces a new resource to be created.
     * > **NOTE:** After creation, the `source_vm_id` property can be removed without forcing a new resource to be created; however, setting it to a different ID will create a new resource.
     * This allows the source vm to be deleted without having to remove the backup.
     */
    @JvmName("xtcntinjnqvocyqo")
    public suspend fun sourceVmId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.sourceVmId = mapped
    }

    internal fun build(): ProtectedVMArgs = ProtectedVMArgs(
        backupPolicyId = backupPolicyId,
        excludeDiskLuns = excludeDiskLuns,
        includeDiskLuns = includeDiskLuns,
        protectionState = protectionState,
        recoveryVaultName = recoveryVaultName,
        resourceGroupName = resourceGroupName,
        sourceVmId = sourceVmId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy