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

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

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

package com.pulumi.azure.backup.kotlin

import com.pulumi.azure.backup.PolicyVMWorkloadArgs.builder
import com.pulumi.azure.backup.kotlin.inputs.PolicyVMWorkloadProtectionPolicyArgs
import com.pulumi.azure.backup.kotlin.inputs.PolicyVMWorkloadProtectionPolicyArgsBuilder
import com.pulumi.azure.backup.kotlin.inputs.PolicyVMWorkloadSettingsArgs
import com.pulumi.azure.backup.kotlin.inputs.PolicyVMWorkloadSettingsArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.jvm.JvmName

/**
 * Manages an Azure VM Workload Backup Policy within a Recovery Services vault.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-bpvmw",
 *     location: "West Europe",
 * });
 * const exampleVault = new azure.recoveryservices.Vault("example", {
 *     name: "example-rsv",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     sku: "Standard",
 *     softDeleteEnabled: false,
 * });
 * const examplePolicyVMWorkload = new azure.backup.PolicyVMWorkload("example", {
 *     name: "example-bpvmw",
 *     resourceGroupName: example.name,
 *     recoveryVaultName: exampleVault.name,
 *     workloadType: "SQLDataBase",
 *     settings: {
 *         timeZone: "UTC",
 *         compressionEnabled: false,
 *     },
 *     protectionPolicies: [
 *         {
 *             policyType: "Full",
 *             backup: {
 *                 frequency: "Daily",
 *                 time: "15:00",
 *             },
 *             retentionDaily: {
 *                 count: 8,
 *             },
 *         },
 *         {
 *             policyType: "Log",
 *             backup: {
 *                 frequencyInMinutes: 15,
 *             },
 *             simpleRetention: {
 *                 count: 8,
 *             },
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-bpvmw",
 *     location="West Europe")
 * example_vault = azure.recoveryservices.Vault("example",
 *     name="example-rsv",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     sku="Standard",
 *     soft_delete_enabled=False)
 * example_policy_vm_workload = azure.backup.PolicyVMWorkload("example",
 *     name="example-bpvmw",
 *     resource_group_name=example.name,
 *     recovery_vault_name=example_vault.name,
 *     workload_type="SQLDataBase",
 *     settings={
 *         "time_zone": "UTC",
 *         "compression_enabled": False,
 *     },
 *     protection_policies=[
 *         {
 *             "policy_type": "Full",
 *             "backup": {
 *                 "frequency": "Daily",
 *                 "time": "15:00",
 *             },
 *             "retention_daily": {
 *                 "count": 8,
 *             },
 *         },
 *         {
 *             "policy_type": "Log",
 *             "backup": {
 *                 "frequency_in_minutes": 15,
 *             },
 *             "simple_retention": {
 *                 "count": 8,
 *             },
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-bpvmw",
 *         Location = "West Europe",
 *     });
 *     var exampleVault = new Azure.RecoveryServices.Vault("example", new()
 *     {
 *         Name = "example-rsv",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Sku = "Standard",
 *         SoftDeleteEnabled = false,
 *     });
 *     var examplePolicyVMWorkload = new Azure.Backup.PolicyVMWorkload("example", new()
 *     {
 *         Name = "example-bpvmw",
 *         ResourceGroupName = example.Name,
 *         RecoveryVaultName = exampleVault.Name,
 *         WorkloadType = "SQLDataBase",
 *         Settings = new Azure.Backup.Inputs.PolicyVMWorkloadSettingsArgs
 *         {
 *             TimeZone = "UTC",
 *             CompressionEnabled = false,
 *         },
 *         ProtectionPolicies = new[]
 *         {
 *             new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicyArgs
 *             {
 *                 PolicyType = "Full",
 *                 Backup = new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicyBackupArgs
 *                 {
 *                     Frequency = "Daily",
 *                     Time = "15:00",
 *                 },
 *                 RetentionDaily = new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicyRetentionDailyArgs
 *                 {
 *                     Count = 8,
 *                 },
 *             },
 *             new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicyArgs
 *             {
 *                 PolicyType = "Log",
 *                 Backup = new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicyBackupArgs
 *                 {
 *                     FrequencyInMinutes = 15,
 *                 },
 *                 SimpleRetention = new Azure.Backup.Inputs.PolicyVMWorkloadProtectionPolicySimpleRetentionArgs
 *                 {
 *                     Count = 8,
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/backup"
 * 	"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 {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-bpvmw"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVault, err := recoveryservices.NewVault(ctx, "example", &recoveryservices.VaultArgs{
 * 			Name:              pulumi.String("example-rsv"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Sku:               pulumi.String("Standard"),
 * 			SoftDeleteEnabled: pulumi.Bool(false),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = backup.NewPolicyVMWorkload(ctx, "example", &backup.PolicyVMWorkloadArgs{
 * 			Name:              pulumi.String("example-bpvmw"),
 * 			ResourceGroupName: example.Name,
 * 			RecoveryVaultName: exampleVault.Name,
 * 			WorkloadType:      pulumi.String("SQLDataBase"),
 * 			Settings: &backup.PolicyVMWorkloadSettingsArgs{
 * 				TimeZone:           pulumi.String("UTC"),
 * 				CompressionEnabled: pulumi.Bool(false),
 * 			},
 * 			ProtectionPolicies: backup.PolicyVMWorkloadProtectionPolicyArray{
 * 				&backup.PolicyVMWorkloadProtectionPolicyArgs{
 * 					PolicyType: pulumi.String("Full"),
 * 					Backup: &backup.PolicyVMWorkloadProtectionPolicyBackupArgs{
 * 						Frequency: pulumi.String("Daily"),
 * 						Time:      pulumi.String("15:00"),
 * 					},
 * 					RetentionDaily: &backup.PolicyVMWorkloadProtectionPolicyRetentionDailyArgs{
 * 						Count: pulumi.Int(8),
 * 					},
 * 				},
 * 				&backup.PolicyVMWorkloadProtectionPolicyArgs{
 * 					PolicyType: pulumi.String("Log"),
 * 					Backup: &backup.PolicyVMWorkloadProtectionPolicyBackupArgs{
 * 						FrequencyInMinutes: pulumi.Int(15),
 * 					},
 * 					SimpleRetention: &backup.PolicyVMWorkloadProtectionPolicySimpleRetentionArgs{
 * 						Count: pulumi.Int(8),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.PolicyVMWorkload;
 * import com.pulumi.azure.backup.PolicyVMWorkloadArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMWorkloadSettingsArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMWorkloadProtectionPolicyArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMWorkloadProtectionPolicyBackupArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMWorkloadProtectionPolicyRetentionDailyArgs;
 * import com.pulumi.azure.backup.inputs.PolicyVMWorkloadProtectionPolicySimpleRetentionArgs;
 * 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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("example-bpvmw")
 *             .location("West Europe")
 *             .build());
 *         var exampleVault = new Vault("exampleVault", VaultArgs.builder()
 *             .name("example-rsv")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .sku("Standard")
 *             .softDeleteEnabled(false)
 *             .build());
 *         var examplePolicyVMWorkload = new PolicyVMWorkload("examplePolicyVMWorkload", PolicyVMWorkloadArgs.builder()
 *             .name("example-bpvmw")
 *             .resourceGroupName(example.name())
 *             .recoveryVaultName(exampleVault.name())
 *             .workloadType("SQLDataBase")
 *             .settings(PolicyVMWorkloadSettingsArgs.builder()
 *                 .timeZone("UTC")
 *                 .compressionEnabled(false)
 *                 .build())
 *             .protectionPolicies(
 *                 PolicyVMWorkloadProtectionPolicyArgs.builder()
 *                     .policyType("Full")
 *                     .backup(PolicyVMWorkloadProtectionPolicyBackupArgs.builder()
 *                         .frequency("Daily")
 *                         .time("15:00")
 *                         .build())
 *                     .retentionDaily(PolicyVMWorkloadProtectionPolicyRetentionDailyArgs.builder()
 *                         .count(8)
 *                         .build())
 *                     .build(),
 *                 PolicyVMWorkloadProtectionPolicyArgs.builder()
 *                     .policyType("Log")
 *                     .backup(PolicyVMWorkloadProtectionPolicyBackupArgs.builder()
 *                         .frequencyInMinutes(15)
 *                         .build())
 *                     .simpleRetention(PolicyVMWorkloadProtectionPolicySimpleRetentionArgs.builder()
 *                         .count(8)
 *                         .build())
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-bpvmw
 *       location: West Europe
 *   exampleVault:
 *     type: azure:recoveryservices:Vault
 *     name: example
 *     properties:
 *       name: example-rsv
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       sku: Standard
 *       softDeleteEnabled: false
 *   examplePolicyVMWorkload:
 *     type: azure:backup:PolicyVMWorkload
 *     name: example
 *     properties:
 *       name: example-bpvmw
 *       resourceGroupName: ${example.name}
 *       recoveryVaultName: ${exampleVault.name}
 *       workloadType: SQLDataBase
 *       settings:
 *         timeZone: UTC
 *         compressionEnabled: false
 *       protectionPolicies:
 *         - policyType: Full
 *           backup:
 *             frequency: Daily
 *             time: 15:00
 *           retentionDaily:
 *             count: 8
 *         - policyType: Log
 *           backup:
 *             frequencyInMinutes: 15
 *           simpleRetention:
 *             count: 8
 * ```
 * 
 * ## Import
 * Azure VM Workload Backup Policies can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:backup/policyVMWorkload:PolicyVMWorkload policy1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.RecoveryServices/vaults/vault1/backupPolicies/policy1
 * ```
 * @property name The name of the VM Workload Backup Policy. Changing this forces a new resource to be created.
 * @property protectionPolicies One or more `protection_policy` blocks as defined below.
 * @property recoveryVaultName The name of the Recovery Services Vault to use. Changing this forces a new resource to be created.
 * @property resourceGroupName The name of the resource group in which to create the VM Workload Backup Policy. Changing this forces a new resource to be created.
 * @property settings A `settings` block as defined below.
 * @property workloadType The VM Workload type for the Backup Policy. Possible values are `SQLDataBase` and `SAPHanaDatabase`. Changing this forces a new resource to be created.
 */
public data class PolicyVMWorkloadArgs(
    public val name: Output? = null,
    public val protectionPolicies: Output>? = null,
    public val recoveryVaultName: Output? = null,
    public val resourceGroupName: Output? = null,
    public val settings: Output? = null,
    public val workloadType: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.backup.PolicyVMWorkloadArgs =
        com.pulumi.azure.backup.PolicyVMWorkloadArgs.builder()
            .name(name?.applyValue({ args0 -> args0 }))
            .protectionPolicies(
                protectionPolicies?.applyValue({ args0 ->
                    args0.map({ args0 ->
                        args0.let({ args0 -> args0.toJava() })
                    })
                }),
            )
            .recoveryVaultName(recoveryVaultName?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .settings(settings?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .workloadType(workloadType?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [PolicyVMWorkloadArgs].
 */
@PulumiTagMarker
public class PolicyVMWorkloadArgsBuilder internal constructor() {
    private var name: Output? = null

    private var protectionPolicies: Output>? = null

    private var recoveryVaultName: Output? = null

    private var resourceGroupName: Output? = null

    private var settings: Output? = null

    private var workloadType: Output? = null

    /**
     * @param value The name of the VM Workload Backup Policy. Changing this forces a new resource to be created.
     */
    @JvmName("ffwkwkkaevrgblyn")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value One or more `protection_policy` blocks as defined below.
     */
    @JvmName("vltduwhvaqwtvmaw")
    public suspend fun protectionPolicies(`value`: Output>) {
        this.protectionPolicies = value
    }

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

    /**
     * @param values One or more `protection_policy` blocks as defined below.
     */
    @JvmName("oxoswogyglykoqky")
    public suspend fun protectionPolicies(values: List>) {
        this.protectionPolicies = Output.all(values)
    }

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

    /**
     * @param value The name of the resource group in which to create the VM Workload Backup Policy. Changing this forces a new resource to be created.
     */
    @JvmName("rbbxnaygrmullesa")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A `settings` block as defined below.
     */
    @JvmName("bqlufqybqbpsydxi")
    public suspend fun settings(`value`: Output) {
        this.settings = value
    }

    /**
     * @param value The VM Workload type for the Backup Policy. Possible values are `SQLDataBase` and `SAPHanaDatabase`. Changing this forces a new resource to be created.
     */
    @JvmName("dtgugvlyjoacixcs")
    public suspend fun workloadType(`value`: Output) {
        this.workloadType = value
    }

    /**
     * @param value The name of the VM Workload Backup Policy. Changing this forces a new resource to be created.
     */
    @JvmName("lplrhsxfuikvirsn")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value One or more `protection_policy` blocks as defined below.
     */
    @JvmName("iytmcamrncvfbuen")
    public suspend fun protectionPolicies(`value`: List?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.protectionPolicies = mapped
    }

    /**
     * @param argument One or more `protection_policy` blocks as defined below.
     */
    @JvmName("grsvtwqjtkisiulo")
    public suspend fun protectionPolicies(argument: List Unit>) {
        val toBeMapped = argument.toList().map {
            PolicyVMWorkloadProtectionPolicyArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.protectionPolicies = mapped
    }

    /**
     * @param argument One or more `protection_policy` blocks as defined below.
     */
    @JvmName("benrsnbptalqbmmq")
    public suspend fun protectionPolicies(vararg argument: suspend PolicyVMWorkloadProtectionPolicyArgsBuilder.() -> Unit) {
        val toBeMapped = argument.toList().map {
            PolicyVMWorkloadProtectionPolicyArgsBuilder().applySuspend { it() }.build()
        }
        val mapped = of(toBeMapped)
        this.protectionPolicies = mapped
    }

    /**
     * @param argument One or more `protection_policy` blocks as defined below.
     */
    @JvmName("jhijbqjlrmrpgbbt")
    public suspend fun protectionPolicies(argument: suspend PolicyVMWorkloadProtectionPolicyArgsBuilder.() -> Unit) {
        val toBeMapped = listOf(
            PolicyVMWorkloadProtectionPolicyArgsBuilder().applySuspend {
                argument()
            }.build(),
        )
        val mapped = of(toBeMapped)
        this.protectionPolicies = mapped
    }

    /**
     * @param values One or more `protection_policy` blocks as defined below.
     */
    @JvmName("vtklwckessrovlck")
    public suspend fun protectionPolicies(vararg values: PolicyVMWorkloadProtectionPolicyArgs) {
        val toBeMapped = values.toList()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.protectionPolicies = mapped
    }

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

    /**
     * @param value The name of the resource group in which to create the VM Workload Backup Policy. Changing this forces a new resource to be created.
     */
    @JvmName("kjncxddwearfwavj")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A `settings` block as defined below.
     */
    @JvmName("ymejblkjtgpirmdh")
    public suspend fun settings(`value`: PolicyVMWorkloadSettingsArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.settings = mapped
    }

    /**
     * @param argument A `settings` block as defined below.
     */
    @JvmName("gbnauhydldynrdfx")
    public suspend fun settings(argument: suspend PolicyVMWorkloadSettingsArgsBuilder.() -> Unit) {
        val toBeMapped = PolicyVMWorkloadSettingsArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.settings = mapped
    }

    /**
     * @param value The VM Workload type for the Backup Policy. Possible values are `SQLDataBase` and `SAPHanaDatabase`. Changing this forces a new resource to be created.
     */
    @JvmName("vtgkurlxlrfksjev")
    public suspend fun workloadType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.workloadType = mapped
    }

    internal fun build(): PolicyVMWorkloadArgs = PolicyVMWorkloadArgs(
        name = name,
        protectionPolicies = protectionPolicies,
        recoveryVaultName = recoveryVaultName,
        resourceGroupName = resourceGroupName,
        settings = settings,
        workloadType = workloadType,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy