# 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 warnings
import pulumi
import pulumi.runtime
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from .. import _utilities, _tables

__all__ = ['RouterInterfaceConnection']


class RouterInterfaceConnection(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 interface_id: Optional[pulumi.Input[str]] = None,
                 opposite_interface_id: Optional[pulumi.Input[str]] = None,
                 opposite_interface_owner_id: Optional[pulumi.Input[str]] = None,
                 opposite_router_id: Optional[pulumi.Input[str]] = None,
                 opposite_router_type: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides a VPC router interface connection resource to connect two router interfaces which are in two different VPCs.
        After that, all of the two router interfaces will be active.

        > **NOTE:** At present, Router interface does not support changing opposite router interface, the connection delete action is only deactivating it to inactive, not modifying the connection to empty.

        > **NOTE:** If you want to changing opposite router interface, you can delete router interface and re-build them.

        > **NOTE:** A integrated router interface connection tunnel requires both InitiatingSide and AcceptingSide configuring opposite router interface.

        > **NOTE:** Please remember to add a `depends_on` clause in the router interface connection from the InitiatingSide to the AcceptingSide, because the connection from the AcceptingSide to the InitiatingSide must be done first.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        region = config.get("region")
        if region is None:
            region = "cn-hangzhou"
        name = config.get("name")
        if name is None:
            name = "alicloudRouterInterfaceConnectionBasic"
        foo_network = alicloud.vpc.Network("fooNetwork", cidr_block="172.16.0.0/12")
        bar_network = alicloud.vpc.Network("barNetwork", cidr_block="192.168.0.0/16",
        opts=ResourceOptions(provider=alicloud))
        initiate = alicloud.vpc.RouterInterface("initiate",
            opposite_region=region,
            router_type="VRouter",
            router_id=foo_network.router_id,
            role="InitiatingSide",
            specification="Large.2",
            description=name,
            instance_charge_type="PostPaid")
        opposite = alicloud.vpc.RouterInterface("opposite",
            opposite_region=region,
            router_type="VRouter",
            router_id=bar_network.router_id,
            role="AcceptingSide",
            specification="Large.1",
            description=f"{name}-opposite",
            opts=ResourceOptions(provider=alicloud))
        bar_router_interface_connection = alicloud.vpc.RouterInterfaceConnection("barRouterInterfaceConnection",
            interface_id=opposite.id,
            opposite_interface_id=initiate.id,
            opts=ResourceOptions(provider=alicloud))
        # A integrated router interface connection tunnel requires both InitiatingSide and AcceptingSide configuring opposite router interface.
        foo_router_interface_connection = alicloud.vpc.RouterInterfaceConnection("fooRouterInterfaceConnection",
            interface_id=initiate.id,
            opposite_interface_id=opposite.id,
            opts=ResourceOptions(depends_on=[bar_router_interface_connection]))
        # The connection must start from the accepting side.
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] interface_id: One side router interface ID.
        :param pulumi.Input[str] opposite_interface_id: Another side router interface ID. It must belong the specified "opposite_interface_owner_id" account.
        :param pulumi.Input[str] opposite_router_id: Another side router ID. It must belong the specified "opposite_interface_owner_id" account. It is valid when field "opposite_interface_owner_id" is specified.
        :param pulumi.Input[str] opposite_router_type: Another side router Type. Optional value: VRouter, VBR. It is valid when field "opposite_interface_owner_id" is specified.
        """
        if __name__ is not None:
            warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning)
            resource_name = __name__
        if __opts__ is not None:
            warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning)
            opts = __opts__
        if opts is None:
            opts = pulumi.ResourceOptions()
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.version is None:
            opts.version = _utilities.get_version()
        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__ = dict()

            if interface_id is None:
                raise TypeError("Missing required property 'interface_id'")
            __props__['interface_id'] = interface_id
            if opposite_interface_id is None:
                raise TypeError("Missing required property 'opposite_interface_id'")
            __props__['opposite_interface_id'] = opposite_interface_id
            __props__['opposite_interface_owner_id'] = opposite_interface_owner_id
            __props__['opposite_router_id'] = opposite_router_id
            __props__['opposite_router_type'] = opposite_router_type
        super(RouterInterfaceConnection, __self__).__init__(
            'alicloud:vpc/routerInterfaceConnection:RouterInterfaceConnection',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            interface_id: Optional[pulumi.Input[str]] = None,
            opposite_interface_id: Optional[pulumi.Input[str]] = None,
            opposite_interface_owner_id: Optional[pulumi.Input[str]] = None,
            opposite_router_id: Optional[pulumi.Input[str]] = None,
            opposite_router_type: Optional[pulumi.Input[str]] = None) -> 'RouterInterfaceConnection':
        """
        Get an existing RouterInterfaceConnection 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] interface_id: One side router interface ID.
        :param pulumi.Input[str] opposite_interface_id: Another side router interface ID. It must belong the specified "opposite_interface_owner_id" account.
        :param pulumi.Input[str] opposite_router_id: Another side router ID. It must belong the specified "opposite_interface_owner_id" account. It is valid when field "opposite_interface_owner_id" is specified.
        :param pulumi.Input[str] opposite_router_type: Another side router Type. Optional value: VRouter, VBR. It is valid when field "opposite_interface_owner_id" is specified.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["interface_id"] = interface_id
        __props__["opposite_interface_id"] = opposite_interface_id
        __props__["opposite_interface_owner_id"] = opposite_interface_owner_id
        __props__["opposite_router_id"] = opposite_router_id
        __props__["opposite_router_type"] = opposite_router_type
        return RouterInterfaceConnection(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="interfaceId")
    def interface_id(self) -> pulumi.Output[str]:
        """
        One side router interface ID.
        """
        return pulumi.get(self, "interface_id")

    @property
    @pulumi.getter(name="oppositeInterfaceId")
    def opposite_interface_id(self) -> pulumi.Output[str]:
        """
        Another side router interface ID. It must belong the specified "opposite_interface_owner_id" account.
        """
        return pulumi.get(self, "opposite_interface_id")

    @property
    @pulumi.getter(name="oppositeInterfaceOwnerId")
    def opposite_interface_owner_id(self) -> pulumi.Output[str]:
        return pulumi.get(self, "opposite_interface_owner_id")

    @property
    @pulumi.getter(name="oppositeRouterId")
    def opposite_router_id(self) -> pulumi.Output[str]:
        """
        Another side router ID. It must belong the specified "opposite_interface_owner_id" account. It is valid when field "opposite_interface_owner_id" is specified.
        """
        return pulumi.get(self, "opposite_router_id")

    @property
    @pulumi.getter(name="oppositeRouterType")
    def opposite_router_type(self) -> pulumi.Output[Optional[str]]:
        """
        Another side router Type. Optional value: VRouter, VBR. It is valid when field "opposite_interface_owner_id" is specified.
        """
        return pulumi.get(self, "opposite_router_type")

    def translate_output_property(self, prop):
        return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop

    def translate_input_property(self, prop):
        return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop

