# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from . import outputs
from ._inputs import *

__all__ = ['ReplicationRecoveryPlanArgs', 'ReplicationRecoveryPlan']

@pulumi.input_type
class ReplicationRecoveryPlanArgs:
    def __init__(__self__, *,
                 recovery_vault_id: pulumi.Input[str],
                 source_recovery_fabric_id: pulumi.Input[str],
                 target_recovery_fabric_id: pulumi.Input[str],
                 name: Optional[pulumi.Input[str]] = None,
                 recovery_groups: Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]] = None):
        """
        The set of arguments for constructing a ReplicationRecoveryPlan resource.
        :param pulumi.Input[str] recovery_vault_id: The ID of the vault that should be updated. Changing this forces a new resource to be created.
        :param pulumi.Input[str] source_recovery_fabric_id: ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        :param pulumi.Input[str] target_recovery_fabric_id: ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        :param pulumi.Input[str] name: The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]] recovery_groups: Three or more `recovery_group` block.
        """
        pulumi.set(__self__, "recovery_vault_id", recovery_vault_id)
        pulumi.set(__self__, "source_recovery_fabric_id", source_recovery_fabric_id)
        pulumi.set(__self__, "target_recovery_fabric_id", target_recovery_fabric_id)
        if name is not None:
            pulumi.set(__self__, "name", name)
        if recovery_groups is not None:
            pulumi.set(__self__, "recovery_groups", recovery_groups)

    @property
    @pulumi.getter(name="recoveryVaultId")
    def recovery_vault_id(self) -> pulumi.Input[str]:
        """
        The ID of the vault that should be updated. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "recovery_vault_id")

    @recovery_vault_id.setter
    def recovery_vault_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "recovery_vault_id", value)

    @property
    @pulumi.getter(name="sourceRecoveryFabricId")
    def source_recovery_fabric_id(self) -> pulumi.Input[str]:
        """
        ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "source_recovery_fabric_id")

    @source_recovery_fabric_id.setter
    def source_recovery_fabric_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "source_recovery_fabric_id", value)

    @property
    @pulumi.getter(name="targetRecoveryFabricId")
    def target_recovery_fabric_id(self) -> pulumi.Input[str]:
        """
        ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "target_recovery_fabric_id")

    @target_recovery_fabric_id.setter
    def target_recovery_fabric_id(self, value: pulumi.Input[str]):
        pulumi.set(self, "target_recovery_fabric_id", value)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "name", value)

    @property
    @pulumi.getter(name="recoveryGroups")
    def recovery_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]]:
        """
        Three or more `recovery_group` block.
        """
        return pulumi.get(self, "recovery_groups")

    @recovery_groups.setter
    def recovery_groups(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]]):
        pulumi.set(self, "recovery_groups", value)


@pulumi.input_type
class _ReplicationRecoveryPlanState:
    def __init__(__self__, *,
                 name: Optional[pulumi.Input[str]] = None,
                 recovery_groups: Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]] = None,
                 recovery_vault_id: Optional[pulumi.Input[str]] = None,
                 source_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
                 target_recovery_fabric_id: Optional[pulumi.Input[str]] = None):
        """
        Input properties used for looking up and filtering ReplicationRecoveryPlan resources.
        :param pulumi.Input[str] name: The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]] recovery_groups: Three or more `recovery_group` block.
        :param pulumi.Input[str] recovery_vault_id: The ID of the vault that should be updated. Changing this forces a new resource to be created.
        :param pulumi.Input[str] source_recovery_fabric_id: ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        :param pulumi.Input[str] target_recovery_fabric_id: ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        if name is not None:
            pulumi.set(__self__, "name", name)
        if recovery_groups is not None:
            pulumi.set(__self__, "recovery_groups", recovery_groups)
        if recovery_vault_id is not None:
            pulumi.set(__self__, "recovery_vault_id", recovery_vault_id)
        if source_recovery_fabric_id is not None:
            pulumi.set(__self__, "source_recovery_fabric_id", source_recovery_fabric_id)
        if target_recovery_fabric_id is not None:
            pulumi.set(__self__, "target_recovery_fabric_id", target_recovery_fabric_id)

    @property
    @pulumi.getter
    def name(self) -> Optional[pulumi.Input[str]]:
        """
        The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @name.setter
    def name(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "name", value)

    @property
    @pulumi.getter(name="recoveryGroups")
    def recovery_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]]:
        """
        Three or more `recovery_group` block.
        """
        return pulumi.get(self, "recovery_groups")

    @recovery_groups.setter
    def recovery_groups(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['ReplicationRecoveryPlanRecoveryGroupArgs']]]]):
        pulumi.set(self, "recovery_groups", value)

    @property
    @pulumi.getter(name="recoveryVaultId")
    def recovery_vault_id(self) -> Optional[pulumi.Input[str]]:
        """
        The ID of the vault that should be updated. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "recovery_vault_id")

    @recovery_vault_id.setter
    def recovery_vault_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "recovery_vault_id", value)

    @property
    @pulumi.getter(name="sourceRecoveryFabricId")
    def source_recovery_fabric_id(self) -> Optional[pulumi.Input[str]]:
        """
        ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "source_recovery_fabric_id")

    @source_recovery_fabric_id.setter
    def source_recovery_fabric_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "source_recovery_fabric_id", value)

    @property
    @pulumi.getter(name="targetRecoveryFabricId")
    def target_recovery_fabric_id(self) -> Optional[pulumi.Input[str]]:
        """
        ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "target_recovery_fabric_id")

    @target_recovery_fabric_id.setter
    def target_recovery_fabric_id(self, value: Optional[pulumi.Input[str]]):
        pulumi.set(self, "target_recovery_fabric_id", value)


class ReplicationRecoveryPlan(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 recovery_groups: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ReplicationRecoveryPlanRecoveryGroupArgs']]]]] = None,
                 recovery_vault_id: Optional[pulumi.Input[str]] = None,
                 source_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
                 target_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        """
        Manages an Azure Site Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        source_resource_group = azure.core.ResourceGroup("sourceResourceGroup", location="west us")
        target_resource_group = azure.core.ResourceGroup("targetResourceGroup", location="east us")
        example_vault = azure.recoveryservices.Vault("exampleVault",
            location=target_resource_group.location,
            resource_group_name=target_resource_group.name,
            sku="Standard")
        source_fabric = azure.siterecovery.Fabric("sourceFabric",
            resource_group_name=azurerm_resource_group["example"]["name"],
            recovery_vault_name=example_vault.name,
            location=source_resource_group.location)
        target_fabric = azure.siterecovery.Fabric("targetFabric",
            resource_group_name=target_resource_group.name,
            recovery_vault_name=example_vault.name,
            location=target_resource_group.location,
            opts=pulumi.ResourceOptions(depends_on=[source_fabric]))
        example_replication_recovery_plan = azure.siterecovery.ReplicationRecoveryPlan("exampleReplicationRecoveryPlan",
            recovery_vault_id=azurerm_recovery_services_vault["target"]["id"],
            source_recovery_fabric_id=source_fabric.id,
            target_recovery_fabric_id=target_fabric.id,
            recovery_groups=[
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Boot",
                    replicated_protected_items=[azurerm_site_recovery_replicated_vm["test"]["id"]],
                ),
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Failover",
                ),
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Shutdown",
                ),
            ])
        ```

        ## Import

        Site Recovery Fabric can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:siterecovery/replicationRecoveryPlan:ReplicationRecoveryPlan azurerm_site_recovery_replication_recovery_plan.example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/groupName/providers/Microsoft.RecoveryServices/vaults/vaultName/replicationRecoveryPlans/planName
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] name: The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ReplicationRecoveryPlanRecoveryGroupArgs']]]] recovery_groups: Three or more `recovery_group` block.
        :param pulumi.Input[str] recovery_vault_id: The ID of the vault that should be updated. Changing this forces a new resource to be created.
        :param pulumi.Input[str] source_recovery_fabric_id: ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        :param pulumi.Input[str] target_recovery_fabric_id: ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: ReplicationRecoveryPlanArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages an Azure Site Recovery Plan within a Recovery Services vault. A recovery plan gathers machines into recovery groups for the purpose of failover.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        source_resource_group = azure.core.ResourceGroup("sourceResourceGroup", location="west us")
        target_resource_group = azure.core.ResourceGroup("targetResourceGroup", location="east us")
        example_vault = azure.recoveryservices.Vault("exampleVault",
            location=target_resource_group.location,
            resource_group_name=target_resource_group.name,
            sku="Standard")
        source_fabric = azure.siterecovery.Fabric("sourceFabric",
            resource_group_name=azurerm_resource_group["example"]["name"],
            recovery_vault_name=example_vault.name,
            location=source_resource_group.location)
        target_fabric = azure.siterecovery.Fabric("targetFabric",
            resource_group_name=target_resource_group.name,
            recovery_vault_name=example_vault.name,
            location=target_resource_group.location,
            opts=pulumi.ResourceOptions(depends_on=[source_fabric]))
        example_replication_recovery_plan = azure.siterecovery.ReplicationRecoveryPlan("exampleReplicationRecoveryPlan",
            recovery_vault_id=azurerm_recovery_services_vault["target"]["id"],
            source_recovery_fabric_id=source_fabric.id,
            target_recovery_fabric_id=target_fabric.id,
            recovery_groups=[
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Boot",
                    replicated_protected_items=[azurerm_site_recovery_replicated_vm["test"]["id"]],
                ),
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Failover",
                ),
                azure.siterecovery.ReplicationRecoveryPlanRecoveryGroupArgs(
                    type="Shutdown",
                ),
            ])
        ```

        ## Import

        Site Recovery Fabric can be imported using the `resource id`, e.g.

        ```sh
         $ pulumi import azure:siterecovery/replicationRecoveryPlan:ReplicationRecoveryPlan azurerm_site_recovery_replication_recovery_plan.example /subscriptions/00000000-0000-0000-0000-00000000000/resourceGroups/groupName/providers/Microsoft.RecoveryServices/vaults/vaultName/replicationRecoveryPlans/planName
        ```

        :param str resource_name: The name of the resource.
        :param ReplicationRecoveryPlanArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(ReplicationRecoveryPlanArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 recovery_groups: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ReplicationRecoveryPlanRecoveryGroupArgs']]]]] = None,
                 recovery_vault_id: Optional[pulumi.Input[str]] = None,
                 source_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
                 target_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = ReplicationRecoveryPlanArgs.__new__(ReplicationRecoveryPlanArgs)

            __props__.__dict__["name"] = name
            __props__.__dict__["recovery_groups"] = recovery_groups
            if recovery_vault_id is None and not opts.urn:
                raise TypeError("Missing required property 'recovery_vault_id'")
            __props__.__dict__["recovery_vault_id"] = recovery_vault_id
            if source_recovery_fabric_id is None and not opts.urn:
                raise TypeError("Missing required property 'source_recovery_fabric_id'")
            __props__.__dict__["source_recovery_fabric_id"] = source_recovery_fabric_id
            if target_recovery_fabric_id is None and not opts.urn:
                raise TypeError("Missing required property 'target_recovery_fabric_id'")
            __props__.__dict__["target_recovery_fabric_id"] = target_recovery_fabric_id
        super(ReplicationRecoveryPlan, __self__).__init__(
            'azure:siterecovery/replicationRecoveryPlan:ReplicationRecoveryPlan',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            name: Optional[pulumi.Input[str]] = None,
            recovery_groups: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ReplicationRecoveryPlanRecoveryGroupArgs']]]]] = None,
            recovery_vault_id: Optional[pulumi.Input[str]] = None,
            source_recovery_fabric_id: Optional[pulumi.Input[str]] = None,
            target_recovery_fabric_id: Optional[pulumi.Input[str]] = None) -> 'ReplicationRecoveryPlan':
        """
        Get an existing ReplicationRecoveryPlan resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] name: The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        :param pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['ReplicationRecoveryPlanRecoveryGroupArgs']]]] recovery_groups: Three or more `recovery_group` block.
        :param pulumi.Input[str] recovery_vault_id: The ID of the vault that should be updated. Changing this forces a new resource to be created.
        :param pulumi.Input[str] source_recovery_fabric_id: ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        :param pulumi.Input[str] target_recovery_fabric_id: ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _ReplicationRecoveryPlanState.__new__(_ReplicationRecoveryPlanState)

        __props__.__dict__["name"] = name
        __props__.__dict__["recovery_groups"] = recovery_groups
        __props__.__dict__["recovery_vault_id"] = recovery_vault_id
        __props__.__dict__["source_recovery_fabric_id"] = source_recovery_fabric_id
        __props__.__dict__["target_recovery_fabric_id"] = target_recovery_fabric_id
        return ReplicationRecoveryPlan(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter
    def name(self) -> pulumi.Output[str]:
        """
        The name of the Replication Plan. The name can contain only letters, numbers, and hyphens. It should start with a letter and end with a letter or a number. Can be a maximum of 63 characters. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="recoveryGroups")
    def recovery_groups(self) -> pulumi.Output[Optional[Sequence['outputs.ReplicationRecoveryPlanRecoveryGroup']]]:
        """
        Three or more `recovery_group` block.
        """
        return pulumi.get(self, "recovery_groups")

    @property
    @pulumi.getter(name="recoveryVaultId")
    def recovery_vault_id(self) -> pulumi.Output[str]:
        """
        The ID of the vault that should be updated. Changing this forces a new resource to be created.
        """
        return pulumi.get(self, "recovery_vault_id")

    @property
    @pulumi.getter(name="sourceRecoveryFabricId")
    def source_recovery_fabric_id(self) -> pulumi.Output[str]:
        """
        ID of source fabric to be recovered from. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "source_recovery_fabric_id")

    @property
    @pulumi.getter(name="targetRecoveryFabricId")
    def target_recovery_fabric_id(self) -> pulumi.Output[str]:
        """
        ID of target fabric to recover. Changing this forces a new Replication Plan to be created.
        """
        return pulumi.get(self, "target_recovery_fabric_id")

