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

com.pulumi.azure.backup.ProtectedVM Maven / Gradle / Ivy

Go to download

A Pulumi package for creating and managing Microsoft Azure cloud resources, based on the Terraform azurerm provider. We recommend using the [Azure Native provider](https://github.com/pulumi/pulumi-azure-native) to provision Azure infrastructure. Azure Native provides complete coverage of Azure resources and same-day access to new resources and resource updates.

There is a newer version: 6.10.0-alpha.1731737215
Show newest version
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.azure.backup;

import com.pulumi.azure.Utilities;
import com.pulumi.azure.backup.ProtectedVMArgs;
import com.pulumi.azure.backup.inputs.ProtectedVMState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * Manages Azure Backup for an Azure VM
 * 
 * ## Example Usage
 * 
 * <!--Start PulumiCodeChooser -->
 * 
 * {@code
 * 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());
 * 
 *     }
 * }
 * }
 * 
* <!--End PulumiCodeChooser --> * * ## 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 * */ @ResourceType(type="azure:backup/protectedVM:ProtectedVM") public class ProtectedVM extends com.pulumi.resources.CustomResource { /** * Specifies the id of the backup policy to use. Required in creation or when `protection_stopped` is not specified. * */ @Export(name="backupPolicyId", refs={String.class}, tree="[0]") private Output backupPolicyId; /** * @return Specifies the id of the backup policy to use. Required in creation or when `protection_stopped` is not specified. * */ public Output> backupPolicyId() { return Codegen.optional(this.backupPolicyId); } /** * A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection. * */ @Export(name="excludeDiskLuns", refs={List.class,Integer.class}, tree="[0,1]") private Output> excludeDiskLuns; /** * @return A list of Disks' Logical Unit Numbers(LUN) to be excluded for VM Protection. * */ public Output>> excludeDiskLuns() { return Codegen.optional(this.excludeDiskLuns); } /** * A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection. * */ @Export(name="includeDiskLuns", refs={List.class,Integer.class}, tree="[0,1]") private Output> includeDiskLuns; /** * @return A list of Disks' Logical Unit Numbers(LUN) to be included for VM Protection. * */ public Output>> includeDiskLuns() { return Codegen.optional(this.includeDiskLuns); } /** * Specifies Protection state of the backup. Possible values are `Invalid`, `IRPending`, `Protected`, `ProtectionStopped`, `ProtectionError` and `ProtectionPaused`. * */ @Export(name="protectionState", refs={String.class}, tree="[0]") private Output protectionState; /** * @return Specifies Protection state of the backup. Possible values are `Invalid`, `IRPending`, `Protected`, `ProtectionStopped`, `ProtectionError` and `ProtectionPaused`. * */ public Output protectionState() { return this.protectionState; } /** * Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created. * */ @Export(name="recoveryVaultName", refs={String.class}, tree="[0]") private Output recoveryVaultName; /** * @return Specifies the name of the Recovery Services Vault to use. Changing this forces a new resource to be created. * */ public Output recoveryVaultName() { return this.recoveryVaultName; } /** * Specifies the name of the Resource Group **associated with** the Recovery Services Vault to use. Changing this forces a new resource to be created. * */ @Export(name="resourceGroupName", refs={String.class}, tree="[0]") private Output resourceGroupName; /** * @return Specifies the name of the Resource Group **associated with** the Recovery Services Vault to use. Changing this forces a new resource to be created. * */ public Output resourceGroupName() { return this.resourceGroupName; } /** * 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. * */ @Export(name="sourceVmId", refs={String.class}, tree="[0]") private Output sourceVmId; /** * @return 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 Output sourceVmId() { return this.sourceVmId; } /** * * @param name The _unique_ name of the resulting resource. */ public ProtectedVM(java.lang.String name) { this(name, ProtectedVMArgs.Empty); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. */ public ProtectedVM(java.lang.String name, ProtectedVMArgs args) { this(name, args, null); } /** * * @param name The _unique_ name of the resulting resource. * @param args The arguments to use to populate this resource's properties. * @param options A bag of options that control this resource's behavior. */ public ProtectedVM(java.lang.String name, ProtectedVMArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:backup/protectedVM:ProtectedVM", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false); } private ProtectedVM(java.lang.String name, Output id, @Nullable ProtectedVMState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { super("azure:backup/protectedVM:ProtectedVM", name, state, makeResourceOptions(options, id), false); } private static ProtectedVMArgs makeArgs(ProtectedVMArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) { if (options != null && options.getUrn().isPresent()) { return null; } return args == null ? ProtectedVMArgs.Empty : args; } private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) { var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder() .version(Utilities.getVersion()) .build(); return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id); } /** * Get an existing Host resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state * @param options Optional settings to control the behavior of the CustomResource. */ public static ProtectedVM get(java.lang.String name, Output id, @Nullable ProtectedVMState state, @Nullable com.pulumi.resources.CustomResourceOptions options) { return new ProtectedVM(name, id, state, options); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy