# 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, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables

__all__ = ['InstanceAttachment']


class InstanceAttachment(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 cen_owner_id: Optional[pulumi.Input[int]] = None,
                 child_instance_id: Optional[pulumi.Input[str]] = None,
                 child_instance_owner_id: Optional[pulumi.Input[int]] = None,
                 child_instance_region_id: Optional[pulumi.Input[str]] = None,
                 child_instance_type: Optional[pulumi.Input[str]] = None,
                 instance_id: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides a CEN child instance attachment resource that associate the network(VPC, CCN, VBR) with the CEN instance.

        ->**NOTE:** Available in 1.42.0+

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        config = pulumi.Config()
        name = config.get("name")
        if name is None:
            name = "tf-testAccCenInstanceAttachmentBasic"
        cen = alicloud.cen.Instance("cen", description="terraform01")
        vpc = alicloud.vpc.Network("vpc", cidr_block="192.168.0.0/16")
        foo = alicloud.cen.InstanceAttachment("foo",
            instance_id=cen.id,
            child_instance_id=vpc.id,
            child_instance_type="VPC",
            child_instance_region_id="cn-beijing")
        ```

        ## Import

        CEN instance can be imported using the id, e.g.

        ```sh
         $ pulumi import alicloud:cen/instanceAttachment:InstanceAttachment example cen-m7i7pjmkon********:vpc-2ze2w07mcy9nz********:VPC:cn-beijing
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[int] cen_owner_id: The account ID to which the CEN instance belongs.
        :param pulumi.Input[str] child_instance_id: The ID of the child instance to attach.
        :param pulumi.Input[int] child_instance_owner_id: The uid of the child instance. Only used when attach a child instance of other account.
        :param pulumi.Input[str] child_instance_region_id: The region ID of the child instance to attach.
        :param pulumi.Input[str] child_instance_type: The type of the associated network. Valid values: `VPC`, `VBR` and `CCN`.
        :param pulumi.Input[str] instance_id: The ID of the CEN.
        """
        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()

            __props__['cen_owner_id'] = cen_owner_id
            if child_instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'child_instance_id'")
            __props__['child_instance_id'] = child_instance_id
            __props__['child_instance_owner_id'] = child_instance_owner_id
            if child_instance_region_id is None and not opts.urn:
                raise TypeError("Missing required property 'child_instance_region_id'")
            __props__['child_instance_region_id'] = child_instance_region_id
            if child_instance_type is None and not opts.urn:
                raise TypeError("Missing required property 'child_instance_type'")
            __props__['child_instance_type'] = child_instance_type
            if instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'instance_id'")
            __props__['instance_id'] = instance_id
            __props__['status'] = None
        super(InstanceAttachment, __self__).__init__(
            'alicloud:cen/instanceAttachment:InstanceAttachment',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            cen_owner_id: Optional[pulumi.Input[int]] = None,
            child_instance_id: Optional[pulumi.Input[str]] = None,
            child_instance_owner_id: Optional[pulumi.Input[int]] = None,
            child_instance_region_id: Optional[pulumi.Input[str]] = None,
            child_instance_type: Optional[pulumi.Input[str]] = None,
            instance_id: Optional[pulumi.Input[str]] = None,
            status: Optional[pulumi.Input[str]] = None) -> 'InstanceAttachment':
        """
        Get an existing InstanceAttachment 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[int] cen_owner_id: The account ID to which the CEN instance belongs.
        :param pulumi.Input[str] child_instance_id: The ID of the child instance to attach.
        :param pulumi.Input[int] child_instance_owner_id: The uid of the child instance. Only used when attach a child instance of other account.
        :param pulumi.Input[str] child_instance_region_id: The region ID of the child instance to attach.
        :param pulumi.Input[str] child_instance_type: The type of the associated network. Valid values: `VPC`, `VBR` and `CCN`.
        :param pulumi.Input[str] instance_id: The ID of the CEN.
        :param pulumi.Input[str] status: The associating status of the network.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["cen_owner_id"] = cen_owner_id
        __props__["child_instance_id"] = child_instance_id
        __props__["child_instance_owner_id"] = child_instance_owner_id
        __props__["child_instance_region_id"] = child_instance_region_id
        __props__["child_instance_type"] = child_instance_type
        __props__["instance_id"] = instance_id
        __props__["status"] = status
        return InstanceAttachment(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="cenOwnerId")
    def cen_owner_id(self) -> pulumi.Output[Optional[int]]:
        """
        The account ID to which the CEN instance belongs.
        """
        return pulumi.get(self, "cen_owner_id")

    @property
    @pulumi.getter(name="childInstanceId")
    def child_instance_id(self) -> pulumi.Output[str]:
        """
        The ID of the child instance to attach.
        """
        return pulumi.get(self, "child_instance_id")

    @property
    @pulumi.getter(name="childInstanceOwnerId")
    def child_instance_owner_id(self) -> pulumi.Output[int]:
        """
        The uid of the child instance. Only used when attach a child instance of other account.
        """
        return pulumi.get(self, "child_instance_owner_id")

    @property
    @pulumi.getter(name="childInstanceRegionId")
    def child_instance_region_id(self) -> pulumi.Output[str]:
        """
        The region ID of the child instance to attach.
        """
        return pulumi.get(self, "child_instance_region_id")

    @property
    @pulumi.getter(name="childInstanceType")
    def child_instance_type(self) -> pulumi.Output[str]:
        """
        The type of the associated network. Valid values: `VPC`, `VBR` and `CCN`.
        """
        return pulumi.get(self, "child_instance_type")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> pulumi.Output[str]:
        """
        The ID of the CEN.
        """
        return pulumi.get(self, "instance_id")

    @property
    @pulumi.getter
    def status(self) -> pulumi.Output[str]:
        """
        The associating status of the network.
        """
        return pulumi.get(self, "status")

    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

