"use strict";
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReplicationRecoveryPlan = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a Site Recovery Replication Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const primary = new azure.core.ResourceGroup("primary", {
 *     name: "tfex-replicated-vm-primary",
 *     location: "West US",
 * });
 * const secondary = new azure.core.ResourceGroup("secondary", {
 *     name: "tfex-replicated-vm-secondary",
 *     location: "East US",
 * });
 * const primaryVirtualNetwork = new azure.network.VirtualNetwork("primary", {
 *     name: "network1",
 *     resourceGroupName: primary.name,
 *     addressSpaces: ["192.168.1.0/24"],
 *     location: primary.location,
 * });
 * const primarySubnet = new azure.network.Subnet("primary", {
 *     name: "network1-subnet",
 *     resourceGroupName: primary.name,
 *     virtualNetworkName: primaryVirtualNetwork.name,
 *     addressPrefixes: ["192.168.1.0/24"],
 * });
 * const primaryPublicIp = new azure.network.PublicIp("primary", {
 *     name: "vm-public-ip-primary",
 *     allocationMethod: "Static",
 *     location: primary.location,
 *     resourceGroupName: primary.name,
 *     sku: "Basic",
 * });
 * const vmNetworkInterface = new azure.network.NetworkInterface("vm", {
 *     name: "vm-nic",
 *     location: primary.location,
 *     resourceGroupName: primary.name,
 *     ipConfigurations: [{
 *         name: "vm",
 *         subnetId: primarySubnet.id,
 *         privateIpAddressAllocation: "Dynamic",
 *         publicIpAddressId: primaryPublicIp.id,
 *     }],
 * });
 * const vm = new azure.compute.VirtualMachine("vm", {
 *     name: "vm",
 *     location: primary.location,
 *     resourceGroupName: primary.name,
 *     vmSize: "Standard_B1s",
 *     networkInterfaceIds: [vmNetworkInterface.id],
 *     storageImageReference: {
 *         publisher: "Canonical",
 *         offer: "0001-com-ubuntu-server-jammy",
 *         sku: "22_04-lts",
 *         version: "latest",
 *     },
 *     storageOsDisk: {
 *         name: "vm-os-disk",
 *         osType: "Linux",
 *         caching: "ReadWrite",
 *         createOption: "FromImage",
 *         managedDiskType: "Premium_LRS",
 *     },
 *     osProfile: {
 *         adminUsername: "test-admin-123",
 *         adminPassword: "test-pwd-123",
 *         computerName: "vm",
 *     },
 *     osProfileLinuxConfig: {
 *         disablePasswordAuthentication: false,
 *     },
 * });
 * const vault = new azure.recoveryservices.Vault("vault", {
 *     name: "example-recovery-vault",
 *     location: secondary.location,
 *     resourceGroupName: secondary.name,
 *     sku: "Standard",
 * });
 * const primaryFabric = new azure.siterecovery.Fabric("primary", {
 *     name: "primary-fabric",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     location: primary.location,
 * });
 * const secondaryFabric = new azure.siterecovery.Fabric("secondary", {
 *     name: "secondary-fabric",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     location: secondary.location,
 * });
 * const primaryProtectionContainer = new azure.siterecovery.ProtectionContainer("primary", {
 *     name: "primary-protection-container",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     recoveryFabricName: primaryFabric.name,
 * });
 * const secondaryProtectionContainer = new azure.siterecovery.ProtectionContainer("secondary", {
 *     name: "secondary-protection-container",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     recoveryFabricName: secondaryFabric.name,
 * });
 * const policy = new azure.siterecovery.ReplicationPolicy("policy", {
 *     name: "policy",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     recoveryPointRetentionInMinutes: 24 * 60,
 *     applicationConsistentSnapshotFrequencyInMinutes: 4 * 60,
 * });
 * const container_mapping = new azure.siterecovery.ProtectionContainerMapping("container-mapping", {
 *     name: "container-mapping",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     recoveryFabricName: primaryFabric.name,
 *     recoverySourceProtectionContainerName: primaryProtectionContainer.name,
 *     recoveryTargetProtectionContainerId: secondaryProtectionContainer.id,
 *     recoveryReplicationPolicyId: policy.id,
 * });
 * const secondaryVirtualNetwork = new azure.network.VirtualNetwork("secondary", {
 *     name: "network2",
 *     resourceGroupName: secondary.name,
 *     addressSpaces: ["192.168.2.0/24"],
 *     location: secondary.location,
 * });
 * const network_mapping = new azure.siterecovery.NetworkMapping("network-mapping", {
 *     name: "network-mapping",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     sourceRecoveryFabricName: primaryFabric.name,
 *     targetRecoveryFabricName: secondaryFabric.name,
 *     sourceNetworkId: primaryVirtualNetwork.id,
 *     targetNetworkId: secondaryVirtualNetwork.id,
 * });
 * const primaryAccount = new azure.storage.Account("primary", {
 *     name: "primaryrecoverycache",
 *     location: primary.location,
 *     resourceGroupName: primary.name,
 *     accountTier: "Standard",
 *     accountReplicationType: "LRS",
 * });
 * const secondarySubnet = new azure.network.Subnet("secondary", {
 *     name: "network2-subnet",
 *     resourceGroupName: secondary.name,
 *     virtualNetworkName: secondaryVirtualNetwork.name,
 *     addressPrefixes: ["192.168.2.0/24"],
 * });
 * const secondaryPublicIp = new azure.network.PublicIp("secondary", {
 *     name: "vm-public-ip-secondary",
 *     allocationMethod: "Static",
 *     location: secondary.location,
 *     resourceGroupName: secondary.name,
 *     sku: "Basic",
 * });
 * const vm_replication = new azure.siterecovery.ReplicatedVM("vm-replication", {
 *     name: "vm-replication",
 *     resourceGroupName: secondary.name,
 *     recoveryVaultName: vault.name,
 *     sourceRecoveryFabricName: primaryFabric.name,
 *     sourceVmId: vm.id,
 *     recoveryReplicationPolicyId: policy.id,
 *     sourceRecoveryProtectionContainerName: primaryProtectionContainer.name,
 *     targetResourceGroupId: secondary.id,
 *     targetRecoveryFabricId: secondaryFabric.id,
 *     targetRecoveryProtectionContainerId: secondaryProtectionContainer.id,
 *     managedDisks: [{
 *         diskId: vm.storageOsDisk.apply(storageOsDisk => storageOsDisk.managedDiskId),
 *         stagingStorageAccountId: primaryAccount.id,
 *         targetResourceGroupId: secondary.id,
 *         targetDiskType: "Premium_LRS",
 *         targetReplicaDiskType: "Premium_LRS",
 *     }],
 *     networkInterfaces: [{
 *         sourceNetworkInterfaceId: vmNetworkInterface.id,
 *         targetSubnetName: secondarySubnet.name,
 *         recoveryPublicIpAddressId: secondaryPublicIp.id,
 *     }],
 * }, {
 *     dependsOn: [
 *         container_mapping,
 *         network_mapping,
 *     ],
 * });
 * const example = new azure.siterecovery.ReplicationRecoveryPlan("example", {
 *     name: "example-recover-plan",
 *     recoveryVaultId: vault.id,
 *     sourceRecoveryFabricId: primaryFabric.id,
 *     targetRecoveryFabricId: secondaryFabric.id,
 *     shutdownRecoveryGroup: {},
 *     failoverRecoveryGroup: {},
 *     bootRecoveryGroups: [{
 *         replicatedProtectedItems: [vm_replication.id],
 *     }],
 * });
 * ```
 *
 * ## API Providers
 *
 * <!-- This section is generated, changes will be overwritten -->
 * This resource uses the following Azure API Providers:
 *
 * * `Microsoft.RecoveryServices` - 2024-04-01
 *
 * ## Import
 *
 * Site Recovery Fabric can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:siterecovery/replicationRecoveryPlan:ReplicationRecoveryPlan example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/groupName/providers/Microsoft.RecoveryServices/vaults/vaultName/replicationRecoveryPlans/planName
 * ```
 */
class ReplicationRecoveryPlan extends pulumi.CustomResource {
    /**
     * Get an existing ReplicationRecoveryPlan 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 Any extra arguments used during the lookup.
     * @param opts Optional settings to control the behavior of the CustomResource.
     */
    static get(name, id, state, opts) {
        return new ReplicationRecoveryPlan(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:siterecovery/replicationRecoveryPlan:ReplicationRecoveryPlan';
    /**
     * Returns true if the given object is an instance of ReplicationRecoveryPlan.  This is designed to work even
     * when multiple copies of the Pulumi SDK have been loaded into the same process.
     */
    static isInstance(obj) {
        if (obj === undefined || obj === null) {
            return false;
        }
        return obj['__pulumiType'] === ReplicationRecoveryPlan.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["azureToAzureSettings"] = state?.azureToAzureSettings;
            resourceInputs["bootRecoveryGroups"] = state?.bootRecoveryGroups;
            resourceInputs["failoverRecoveryGroup"] = state?.failoverRecoveryGroup;
            resourceInputs["name"] = state?.name;
            resourceInputs["recoveryVaultId"] = state?.recoveryVaultId;
            resourceInputs["shutdownRecoveryGroup"] = state?.shutdownRecoveryGroup;
            resourceInputs["sourceRecoveryFabricId"] = state?.sourceRecoveryFabricId;
            resourceInputs["targetRecoveryFabricId"] = state?.targetRecoveryFabricId;
        }
        else {
            const args = argsOrState;
            if (args?.bootRecoveryGroups === undefined && !opts.urn) {
                throw new Error("Missing required property 'bootRecoveryGroups'");
            }
            if (args?.failoverRecoveryGroup === undefined && !opts.urn) {
                throw new Error("Missing required property 'failoverRecoveryGroup'");
            }
            if (args?.recoveryVaultId === undefined && !opts.urn) {
                throw new Error("Missing required property 'recoveryVaultId'");
            }
            if (args?.shutdownRecoveryGroup === undefined && !opts.urn) {
                throw new Error("Missing required property 'shutdownRecoveryGroup'");
            }
            if (args?.sourceRecoveryFabricId === undefined && !opts.urn) {
                throw new Error("Missing required property 'sourceRecoveryFabricId'");
            }
            if (args?.targetRecoveryFabricId === undefined && !opts.urn) {
                throw new Error("Missing required property 'targetRecoveryFabricId'");
            }
            resourceInputs["azureToAzureSettings"] = args?.azureToAzureSettings;
            resourceInputs["bootRecoveryGroups"] = args?.bootRecoveryGroups;
            resourceInputs["failoverRecoveryGroup"] = args?.failoverRecoveryGroup;
            resourceInputs["name"] = args?.name;
            resourceInputs["recoveryVaultId"] = args?.recoveryVaultId;
            resourceInputs["shutdownRecoveryGroup"] = args?.shutdownRecoveryGroup;
            resourceInputs["sourceRecoveryFabricId"] = args?.sourceRecoveryFabricId;
            resourceInputs["targetRecoveryFabricId"] = args?.targetRecoveryFabricId;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(ReplicationRecoveryPlan.__pulumiType, name, resourceInputs, opts);
    }
}
exports.ReplicationRecoveryPlan = ReplicationRecoveryPlan;
//# sourceMappingURL=replicationRecoveryPlan.js.map