# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from .. import _utilities

__all__ = ['VbrHaArgs', 'VbrHa']

@pulumi.input_type
class VbrHaArgs:
    def __init__(__self__, *,
                 peer_vbr_id: pulumi.Input[_builtins.str],
                 vbr_id: pulumi.Input[_builtins.str],
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 dry_run: Optional[pulumi.Input[_builtins.bool]] = None,
                 vbr_ha_name: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a VbrHa resource.
        :param pulumi.Input[_builtins.str] peer_vbr_id: The instance ID of another VBR in The VBR switching group.
        :param pulumi.Input[_builtins.str] vbr_id: The VBR instance ID.
        :param pulumi.Input[_builtins.str] description: The description of the VBR switching group.
               It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        :param pulumi.Input[_builtins.bool] dry_run: Whether to PreCheck only this request. Value range:
               - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
               - *false** (default): Send a normal request and start the instance directly after passing the check.
        :param pulumi.Input[_builtins.str] vbr_ha_name: VBR switch group name.
        """
        pulumi.set(__self__, "peer_vbr_id", peer_vbr_id)
        pulumi.set(__self__, "vbr_id", vbr_id)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if dry_run is not None:
            pulumi.set(__self__, "dry_run", dry_run)
        if vbr_ha_name is not None:
            pulumi.set(__self__, "vbr_ha_name", vbr_ha_name)

    @_builtins.property
    @pulumi.getter(name="peerVbrId")
    def peer_vbr_id(self) -> pulumi.Input[_builtins.str]:
        """
        The instance ID of another VBR in The VBR switching group.
        """
        return pulumi.get(self, "peer_vbr_id")

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

    @_builtins.property
    @pulumi.getter(name="vbrId")
    def vbr_id(self) -> pulumi.Input[_builtins.str]:
        """
        The VBR instance ID.
        """
        return pulumi.get(self, "vbr_id")

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

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The description of the VBR switching group.
        It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        """
        return pulumi.get(self, "description")

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

    @_builtins.property
    @pulumi.getter(name="dryRun")
    def dry_run(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Whether to PreCheck only this request. Value range:
        - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
        - *false** (default): Send a normal request and start the instance directly after passing the check.
        """
        return pulumi.get(self, "dry_run")

    @dry_run.setter
    def dry_run(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "dry_run", value)

    @_builtins.property
    @pulumi.getter(name="vbrHaName")
    def vbr_ha_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        VBR switch group name.
        """
        return pulumi.get(self, "vbr_ha_name")

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


@pulumi.input_type
class _VbrHaState:
    def __init__(__self__, *,
                 create_time: Optional[pulumi.Input[_builtins.str]] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 dry_run: Optional[pulumi.Input[_builtins.bool]] = None,
                 peer_vbr_id: Optional[pulumi.Input[_builtins.str]] = None,
                 region_id: Optional[pulumi.Input[_builtins.str]] = None,
                 status: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_ha_name: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_id: Optional[pulumi.Input[_builtins.str]] = None):
        """
        Input properties used for looking up and filtering VbrHa resources.
        :param pulumi.Input[_builtins.str] create_time: The creation time of the VBR.
        :param pulumi.Input[_builtins.str] description: The description of the VBR switching group.
               It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        :param pulumi.Input[_builtins.bool] dry_run: Whether to PreCheck only this request. Value range:
               - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
               - *false** (default): Send a normal request and start the instance directly after passing the check.
        :param pulumi.Input[_builtins.str] peer_vbr_id: The instance ID of another VBR in The VBR switching group.
        :param pulumi.Input[_builtins.str] region_id: The ID of the region to which the VBR belongs.
        :param pulumi.Input[_builtins.str] status: Status of VBR switching Group
        :param pulumi.Input[_builtins.str] vbr_ha_name: VBR switch group name.
        :param pulumi.Input[_builtins.str] vbr_id: The VBR instance ID.
        """
        if create_time is not None:
            pulumi.set(__self__, "create_time", create_time)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if dry_run is not None:
            pulumi.set(__self__, "dry_run", dry_run)
        if peer_vbr_id is not None:
            pulumi.set(__self__, "peer_vbr_id", peer_vbr_id)
        if region_id is not None:
            pulumi.set(__self__, "region_id", region_id)
        if status is not None:
            pulumi.set(__self__, "status", status)
        if vbr_ha_name is not None:
            pulumi.set(__self__, "vbr_ha_name", vbr_ha_name)
        if vbr_id is not None:
            pulumi.set(__self__, "vbr_id", vbr_id)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The creation time of the VBR.
        """
        return pulumi.get(self, "create_time")

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

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The description of the VBR switching group.
        It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        """
        return pulumi.get(self, "description")

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

    @_builtins.property
    @pulumi.getter(name="dryRun")
    def dry_run(self) -> Optional[pulumi.Input[_builtins.bool]]:
        """
        Whether to PreCheck only this request. Value range:
        - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
        - *false** (default): Send a normal request and start the instance directly after passing the check.
        """
        return pulumi.get(self, "dry_run")

    @dry_run.setter
    def dry_run(self, value: Optional[pulumi.Input[_builtins.bool]]):
        pulumi.set(self, "dry_run", value)

    @_builtins.property
    @pulumi.getter(name="peerVbrId")
    def peer_vbr_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The instance ID of another VBR in The VBR switching group.
        """
        return pulumi.get(self, "peer_vbr_id")

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

    @_builtins.property
    @pulumi.getter(name="regionId")
    def region_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The ID of the region to which the VBR belongs.
        """
        return pulumi.get(self, "region_id")

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

    @_builtins.property
    @pulumi.getter
    def status(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Status of VBR switching Group
        """
        return pulumi.get(self, "status")

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

    @_builtins.property
    @pulumi.getter(name="vbrHaName")
    def vbr_ha_name(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        VBR switch group name.
        """
        return pulumi.get(self, "vbr_ha_name")

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

    @_builtins.property
    @pulumi.getter(name="vbrId")
    def vbr_id(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The VBR instance ID.
        """
        return pulumi.get(self, "vbr_id")

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


@pulumi.type_token("alicloud:vpc/vbrHa:VbrHa")
class VbrHa(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 dry_run: Optional[pulumi.Input[_builtins.bool]] = None,
                 peer_vbr_id: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_ha_name: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_id: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        Provides a Express Connect Vbr Ha resource.

        VBR switching Group.

        For information about Express Connect Vbr Ha and how to use it, see [What is Vbr Ha](https://www.alibabacloud.com/help/doc-detail/212629.html).

        > **NOTE:** Available since v1.151.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud
        import pulumi_random as random
        import pulumi_std as std

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "tf-example"
        default = alicloud.get_regions(current=True)
        example = alicloud.expressconnect.get_physical_connections(name_regex="^preserved-NODELETING")
        vlan_id = random.index.Integer("vlan_id",
            max=2999,
            min=1)
        example_virtual_border_router = []
        for range in [{"value": i} for i in range(0, 2)]:
            example_virtual_border_router.append(alicloud.expressconnect.VirtualBorderRouter(f"example-{range['value']}",
                local_gateway_ip="10.0.0.1",
                peer_gateway_ip="10.0.0.2",
                peering_subnet_mask="255.255.255.252",
                physical_connection_id=example.connections[range["value"]].id,
                virtual_border_router_name=std.format(input=f"{name}-%d",
                    args=[range["value"] + 1]).result,
                vlan_id=vlan_id["id"] + range["value"],
                min_rx_interval=1000,
                min_tx_interval=1000,
                detect_multiplier=10))
        example_instance = alicloud.cen.Instance("example",
            cen_instance_name=name,
            description=name,
            protection_level="REDUCED")
        example_instance_attachment = []
        for range in [{"value": i} for i in range(0, 2)]:
            example_instance_attachment.append(alicloud.cen.InstanceAttachment(f"example-{range['value']}",
                instance_id=example_instance.id,
                child_instance_id=example_virtual_border_router[range["value"]].id,
                child_instance_type="VBR",
                child_instance_region_id=default.regions[0].id))
        example_vbr_ha = alicloud.vpc.VbrHa("example",
            vbr_id=example_instance_attachment[0].child_instance_id,
            peer_vbr_id=example_instance_attachment[1].child_instance_id,
            vbr_ha_name=name,
            description=name)
        ```

        ## Import

        Express Connect Vbr Ha can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:vpc/vbrHa:VbrHa example <id>
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] description: The description of the VBR switching group.
               It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        :param pulumi.Input[_builtins.bool] dry_run: Whether to PreCheck only this request. Value range:
               - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
               - *false** (default): Send a normal request and start the instance directly after passing the check.
        :param pulumi.Input[_builtins.str] peer_vbr_id: The instance ID of another VBR in The VBR switching group.
        :param pulumi.Input[_builtins.str] vbr_ha_name: VBR switch group name.
        :param pulumi.Input[_builtins.str] vbr_id: The VBR instance ID.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: VbrHaArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Provides a Express Connect Vbr Ha resource.

        VBR switching Group.

        For information about Express Connect Vbr Ha and how to use it, see [What is Vbr Ha](https://www.alibabacloud.com/help/doc-detail/212629.html).

        > **NOTE:** Available since v1.151.0.

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud
        import pulumi_random as random
        import pulumi_std as std

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "tf-example"
        default = alicloud.get_regions(current=True)
        example = alicloud.expressconnect.get_physical_connections(name_regex="^preserved-NODELETING")
        vlan_id = random.index.Integer("vlan_id",
            max=2999,
            min=1)
        example_virtual_border_router = []
        for range in [{"value": i} for i in range(0, 2)]:
            example_virtual_border_router.append(alicloud.expressconnect.VirtualBorderRouter(f"example-{range['value']}",
                local_gateway_ip="10.0.0.1",
                peer_gateway_ip="10.0.0.2",
                peering_subnet_mask="255.255.255.252",
                physical_connection_id=example.connections[range["value"]].id,
                virtual_border_router_name=std.format(input=f"{name}-%d",
                    args=[range["value"] + 1]).result,
                vlan_id=vlan_id["id"] + range["value"],
                min_rx_interval=1000,
                min_tx_interval=1000,
                detect_multiplier=10))
        example_instance = alicloud.cen.Instance("example",
            cen_instance_name=name,
            description=name,
            protection_level="REDUCED")
        example_instance_attachment = []
        for range in [{"value": i} for i in range(0, 2)]:
            example_instance_attachment.append(alicloud.cen.InstanceAttachment(f"example-{range['value']}",
                instance_id=example_instance.id,
                child_instance_id=example_virtual_border_router[range["value"]].id,
                child_instance_type="VBR",
                child_instance_region_id=default.regions[0].id))
        example_vbr_ha = alicloud.vpc.VbrHa("example",
            vbr_id=example_instance_attachment[0].child_instance_id,
            peer_vbr_id=example_instance_attachment[1].child_instance_id,
            vbr_ha_name=name,
            description=name)
        ```

        ## Import

        Express Connect Vbr Ha can be imported using the id, e.g.

        ```sh
        $ pulumi import alicloud:vpc/vbrHa:VbrHa example <id>
        ```

        :param str resource_name: The name of the resource.
        :param VbrHaArgs 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(VbrHaArgs, 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,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 dry_run: Optional[pulumi.Input[_builtins.bool]] = None,
                 peer_vbr_id: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_ha_name: Optional[pulumi.Input[_builtins.str]] = None,
                 vbr_id: Optional[pulumi.Input[_builtins.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__ = VbrHaArgs.__new__(VbrHaArgs)

            __props__.__dict__["description"] = description
            __props__.__dict__["dry_run"] = dry_run
            if peer_vbr_id is None and not opts.urn:
                raise TypeError("Missing required property 'peer_vbr_id'")
            __props__.__dict__["peer_vbr_id"] = peer_vbr_id
            __props__.__dict__["vbr_ha_name"] = vbr_ha_name
            if vbr_id is None and not opts.urn:
                raise TypeError("Missing required property 'vbr_id'")
            __props__.__dict__["vbr_id"] = vbr_id
            __props__.__dict__["create_time"] = None
            __props__.__dict__["region_id"] = None
            __props__.__dict__["status"] = None
        super(VbrHa, __self__).__init__(
            'alicloud:vpc/vbrHa:VbrHa',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            create_time: Optional[pulumi.Input[_builtins.str]] = None,
            description: Optional[pulumi.Input[_builtins.str]] = None,
            dry_run: Optional[pulumi.Input[_builtins.bool]] = None,
            peer_vbr_id: Optional[pulumi.Input[_builtins.str]] = None,
            region_id: Optional[pulumi.Input[_builtins.str]] = None,
            status: Optional[pulumi.Input[_builtins.str]] = None,
            vbr_ha_name: Optional[pulumi.Input[_builtins.str]] = None,
            vbr_id: Optional[pulumi.Input[_builtins.str]] = None) -> 'VbrHa':
        """
        Get an existing VbrHa 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[_builtins.str] create_time: The creation time of the VBR.
        :param pulumi.Input[_builtins.str] description: The description of the VBR switching group.
               It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        :param pulumi.Input[_builtins.bool] dry_run: Whether to PreCheck only this request. Value range:
               - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
               - *false** (default): Send a normal request and start the instance directly after passing the check.
        :param pulumi.Input[_builtins.str] peer_vbr_id: The instance ID of another VBR in The VBR switching group.
        :param pulumi.Input[_builtins.str] region_id: The ID of the region to which the VBR belongs.
        :param pulumi.Input[_builtins.str] status: Status of VBR switching Group
        :param pulumi.Input[_builtins.str] vbr_ha_name: VBR switch group name.
        :param pulumi.Input[_builtins.str] vbr_id: The VBR instance ID.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _VbrHaState.__new__(_VbrHaState)

        __props__.__dict__["create_time"] = create_time
        __props__.__dict__["description"] = description
        __props__.__dict__["dry_run"] = dry_run
        __props__.__dict__["peer_vbr_id"] = peer_vbr_id
        __props__.__dict__["region_id"] = region_id
        __props__.__dict__["status"] = status
        __props__.__dict__["vbr_ha_name"] = vbr_ha_name
        __props__.__dict__["vbr_id"] = vbr_id
        return VbrHa(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> pulumi.Output[_builtins.str]:
        """
        The creation time of the VBR.
        """
        return pulumi.get(self, "create_time")

    @_builtins.property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The description of the VBR switching group.
        It must be 2 to 256 characters in length and must start with a letter or Chinese, but cannot start with 'http:// 'or 'https.
        """
        return pulumi.get(self, "description")

    @_builtins.property
    @pulumi.getter(name="dryRun")
    def dry_run(self) -> pulumi.Output[Optional[_builtins.bool]]:
        """
        Whether to PreCheck only this request. Value range:
        - *true**: The check request is sent and the instance is not started. Check whether the required parameters, request format, and instance status are filled in. If the check does not pass, the corresponding error is returned. If the check passes, DRYRUN.SUCCESS is returned.
        - *false** (default): Send a normal request and start the instance directly after passing the check.
        """
        return pulumi.get(self, "dry_run")

    @_builtins.property
    @pulumi.getter(name="peerVbrId")
    def peer_vbr_id(self) -> pulumi.Output[_builtins.str]:
        """
        The instance ID of another VBR in The VBR switching group.
        """
        return pulumi.get(self, "peer_vbr_id")

    @_builtins.property
    @pulumi.getter(name="regionId")
    def region_id(self) -> pulumi.Output[_builtins.str]:
        """
        The ID of the region to which the VBR belongs.
        """
        return pulumi.get(self, "region_id")

    @_builtins.property
    @pulumi.getter
    def status(self) -> pulumi.Output[_builtins.str]:
        """
        Status of VBR switching Group
        """
        return pulumi.get(self, "status")

    @_builtins.property
    @pulumi.getter(name="vbrHaName")
    def vbr_ha_name(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        VBR switch group name.
        """
        return pulumi.get(self, "vbr_ha_name")

    @_builtins.property
    @pulumi.getter(name="vbrId")
    def vbr_id(self) -> pulumi.Output[_builtins.str]:
        """
        The VBR instance ID.
        """
        return pulumi.get(self, "vbr_id")

