# 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__ = ['Topic']


class Topic(pulumi.CustomResource):
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 compact_topic: Optional[pulumi.Input[bool]] = None,
                 instance_id: Optional[pulumi.Input[str]] = None,
                 local_topic: Optional[pulumi.Input[bool]] = None,
                 partition_num: Optional[pulumi.Input[int]] = None,
                 remark: Optional[pulumi.Input[str]] = None,
                 tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
                 topic: Optional[pulumi.Input[str]] = None,
                 __props__=None,
                 __name__=None,
                 __opts__=None):
        """
        Provides an ALIKAFKA topic resource.

        > **NOTE:** Available in 1.56.0+

        > **NOTE:**  Only the following regions support create alikafka topic.
        [`cn-hangzhou`,`cn-beijing`,`cn-shenzhen`,`cn-shanghai`,`cn-qingdao`,`cn-hongkong`,`cn-huhehaote`,`cn-zhangjiakou`,`ap-southeast-1`,`ap-south-1`,`ap-southeast-5`]

        ## Example Usage

        Basic Usage

        ```python
        import pulumi
        import pulumi_alicloud as alicloud

        default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
        default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/12")
        default_switch = alicloud.vpc.Switch("defaultSwitch",
            vpc_id=default_network.id,
            cidr_block="172.16.0.0/24",
            availability_zone=default_zones.zones[0].id)
        default_instance = alicloud.alikafka.Instance("defaultInstance",
            topic_quota=50,
            disk_type=1,
            disk_size=500,
            deploy_type=5,
            io_max=20,
            vswitch_id=default_switch.id)
        config = pulumi.Config()
        topic = config.get("topic")
        if topic is None:
            topic = "alikafkaTopicName"
        default_topic = alicloud.alikafka.Topic("defaultTopic",
            instance_id=default_instance.id,
            topic=topic,
            local_topic=False,
            compact_topic=False,
            partition_num=12,
            remark="dafault_kafka_topic_remark")
        ```

        ## Import

        ALIKAFKA TOPIC can be imported using the id, e.g.

        ```sh
         $ pulumi import alicloud:alikafka/topic:Topic topic alikafka_post-cn-123455abc:topicName
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[bool] compact_topic: Whether the topic is compactTopic or not. Compact topic must be a localTopic.
        :param pulumi.Input[str] instance_id: InstanceId of your Kafka resource, the topic will create in this instance.
        :param pulumi.Input[bool] local_topic: Whether the topic is localTopic or not.
        :param pulumi.Input[int] partition_num: The number of partitions of the topic. The number should between 1 and 48.
        :param pulumi.Input[str] remark: This attribute is a concise description of topic. The length cannot exceed 64.
        :param pulumi.Input[Mapping[str, Any]] tags: A mapping of tags to assign to the resource.
        :param pulumi.Input[str] topic: Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.
        """
        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__['compact_topic'] = compact_topic
            if instance_id is None and not opts.urn:
                raise TypeError("Missing required property 'instance_id'")
            __props__['instance_id'] = instance_id
            __props__['local_topic'] = local_topic
            __props__['partition_num'] = partition_num
            if remark is None and not opts.urn:
                raise TypeError("Missing required property 'remark'")
            __props__['remark'] = remark
            __props__['tags'] = tags
            if topic is None and not opts.urn:
                raise TypeError("Missing required property 'topic'")
            __props__['topic'] = topic
        super(Topic, __self__).__init__(
            'alicloud:alikafka/topic:Topic',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            compact_topic: Optional[pulumi.Input[bool]] = None,
            instance_id: Optional[pulumi.Input[str]] = None,
            local_topic: Optional[pulumi.Input[bool]] = None,
            partition_num: Optional[pulumi.Input[int]] = None,
            remark: Optional[pulumi.Input[str]] = None,
            tags: Optional[pulumi.Input[Mapping[str, Any]]] = None,
            topic: Optional[pulumi.Input[str]] = None) -> 'Topic':
        """
        Get an existing Topic 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[bool] compact_topic: Whether the topic is compactTopic or not. Compact topic must be a localTopic.
        :param pulumi.Input[str] instance_id: InstanceId of your Kafka resource, the topic will create in this instance.
        :param pulumi.Input[bool] local_topic: Whether the topic is localTopic or not.
        :param pulumi.Input[int] partition_num: The number of partitions of the topic. The number should between 1 and 48.
        :param pulumi.Input[str] remark: This attribute is a concise description of topic. The length cannot exceed 64.
        :param pulumi.Input[Mapping[str, Any]] tags: A mapping of tags to assign to the resource.
        :param pulumi.Input[str] topic: Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["compact_topic"] = compact_topic
        __props__["instance_id"] = instance_id
        __props__["local_topic"] = local_topic
        __props__["partition_num"] = partition_num
        __props__["remark"] = remark
        __props__["tags"] = tags
        __props__["topic"] = topic
        return Topic(resource_name, opts=opts, __props__=__props__)

    @property
    @pulumi.getter(name="compactTopic")
    def compact_topic(self) -> pulumi.Output[Optional[bool]]:
        """
        Whether the topic is compactTopic or not. Compact topic must be a localTopic.
        """
        return pulumi.get(self, "compact_topic")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> pulumi.Output[str]:
        """
        InstanceId of your Kafka resource, the topic will create in this instance.
        """
        return pulumi.get(self, "instance_id")

    @property
    @pulumi.getter(name="localTopic")
    def local_topic(self) -> pulumi.Output[Optional[bool]]:
        """
        Whether the topic is localTopic or not.
        """
        return pulumi.get(self, "local_topic")

    @property
    @pulumi.getter(name="partitionNum")
    def partition_num(self) -> pulumi.Output[Optional[int]]:
        """
        The number of partitions of the topic. The number should between 1 and 48.
        """
        return pulumi.get(self, "partition_num")

    @property
    @pulumi.getter
    def remark(self) -> pulumi.Output[str]:
        """
        This attribute is a concise description of topic. The length cannot exceed 64.
        """
        return pulumi.get(self, "remark")

    @property
    @pulumi.getter
    def tags(self) -> pulumi.Output[Optional[Mapping[str, Any]]]:
        """
        A mapping of tags to assign to the resource.
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter
    def topic(self) -> pulumi.Output[str]:
        """
        Name of the topic. Two topics on a single instance cannot have the same name. The length cannot exceed 64 characters.
        """
        return pulumi.get(self, "topic")

    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

