# 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 builtins
import copy
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
from . import outputs

__all__ = [
    'GetTopicResult',
    'AwaitableGetTopicResult',
    'get_topic',
    'get_topic_output',
]

@pulumi.output_type
class GetTopicResult:
    """
    A collection of values returned by getTopic.
    """
    def __init__(__self__, access_policies=None, all_authority=None, cleanup_policies=None, created_time=None, description=None, id=None, instance_id=None, log_retention_hours=None, parameters=None, partition_number=None, replica_number=None, status=None, tags=None, topic_name=None, used_storage_percentage_in_instance=None, used_storage_space_in_bytes=None):
        if access_policies and not isinstance(access_policies, list):
            raise TypeError("Expected argument 'access_policies' to be a list")
        pulumi.set(__self__, "access_policies", access_policies)
        if all_authority and not isinstance(all_authority, bool):
            raise TypeError("Expected argument 'all_authority' to be a bool")
        pulumi.set(__self__, "all_authority", all_authority)
        if cleanup_policies and not isinstance(cleanup_policies, list):
            raise TypeError("Expected argument 'cleanup_policies' to be a list")
        pulumi.set(__self__, "cleanup_policies", cleanup_policies)
        if created_time and not isinstance(created_time, str):
            raise TypeError("Expected argument 'created_time' to be a str")
        pulumi.set(__self__, "created_time", created_time)
        if description and not isinstance(description, str):
            raise TypeError("Expected argument 'description' to be a str")
        pulumi.set(__self__, "description", description)
        if id and not isinstance(id, str):
            raise TypeError("Expected argument 'id' to be a str")
        pulumi.set(__self__, "id", id)
        if instance_id and not isinstance(instance_id, str):
            raise TypeError("Expected argument 'instance_id' to be a str")
        pulumi.set(__self__, "instance_id", instance_id)
        if log_retention_hours and not isinstance(log_retention_hours, int):
            raise TypeError("Expected argument 'log_retention_hours' to be a int")
        pulumi.set(__self__, "log_retention_hours", log_retention_hours)
        if parameters and not isinstance(parameters, str):
            raise TypeError("Expected argument 'parameters' to be a str")
        pulumi.set(__self__, "parameters", parameters)
        if partition_number and not isinstance(partition_number, int):
            raise TypeError("Expected argument 'partition_number' to be a int")
        pulumi.set(__self__, "partition_number", partition_number)
        if replica_number and not isinstance(replica_number, int):
            raise TypeError("Expected argument 'replica_number' to be a int")
        pulumi.set(__self__, "replica_number", replica_number)
        if status and not isinstance(status, str):
            raise TypeError("Expected argument 'status' to be a str")
        pulumi.set(__self__, "status", status)
        if tags and not isinstance(tags, list):
            raise TypeError("Expected argument 'tags' to be a list")
        pulumi.set(__self__, "tags", tags)
        if topic_name and not isinstance(topic_name, str):
            raise TypeError("Expected argument 'topic_name' to be a str")
        pulumi.set(__self__, "topic_name", topic_name)
        if used_storage_percentage_in_instance and not isinstance(used_storage_percentage_in_instance, float):
            raise TypeError("Expected argument 'used_storage_percentage_in_instance' to be a float")
        pulumi.set(__self__, "used_storage_percentage_in_instance", used_storage_percentage_in_instance)
        if used_storage_space_in_bytes and not isinstance(used_storage_space_in_bytes, int):
            raise TypeError("Expected argument 'used_storage_space_in_bytes' to be a int")
        pulumi.set(__self__, "used_storage_space_in_bytes", used_storage_space_in_bytes)

    @property
    @pulumi.getter(name="accessPolicies")
    def access_policies(self) -> Sequence['outputs.GetTopicAccessPolicyResult']:
        """
        自定义权限配置，即为某些用户设置对于此 Topic 的自定义权限。仅在 AllAuthority 为 False 时需要设置。
        """
        return pulumi.get(self, "access_policies")

    @property
    @pulumi.getter(name="allAuthority")
    def all_authority(self) -> builtins.bool:
        """
        待创建的Topic默认是否对所有用户都开启读写权限。true：（默认）所有用户都具备此 Topic 的读写权限。false：并非所有用户都具备此 Topic 的读写权限。默认情况下，用户对于此 Topic 的权限沿用用户的默认权限，如果默认权限不满足需求，您也可以通过 AccessPolicies 指定某个用户对于此 Topic 的自定义权限。
        """
        return pulumi.get(self, "all_authority")

    @property
    @pulumi.getter(name="cleanupPolicies")
    def cleanup_policies(self) -> Sequence[builtins.str]:
        """
        Topic 的消息清理策略，支持以下三种取值方式：[delete]：默认的消息清理策略。在磁盘容量充足的情况下，保留在最长保留时间范围内的消息；在磁盘容量不足时，将提前删除旧消息，以保证服务可用性。[compact]：COMPACT 消息清理策略针对每个消息的 Key 进行整合，对于有相同 Key 的消息，只保留最新的 value 值，旧的记录则会被清除。[delete,compact]：同时配置 DELETE 和 COMPACT 两种消息清理策略。只要消息满足任一条清理策略时，都将被清除。
        """
        return pulumi.get(self, "cleanup_policies")

    @property
    @pulumi.getter(name="createdTime")
    def created_time(self) -> builtins.str:
        """
        Topic 的创建时间。
        """
        return pulumi.get(self, "created_time")

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        Topic 的描述信息。长度不超过 128 个字符。
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter
    def id(self) -> builtins.str:
        """
        Uniquely identifies the resource.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="instanceId")
    def instance_id(self) -> builtins.str:
        """
        实例 ID。
        """
        return pulumi.get(self, "instance_id")

    @property
    @pulumi.getter(name="logRetentionHours")
    def log_retention_hours(self) -> builtins.int:
        """
        消息保留时长，单位小时。Topic维度的消息保留时长，取值范围：1   - 2160小时（90天）。
        """
        return pulumi.get(self, "log_retention_hours")

    @property
    @pulumi.getter
    def parameters(self) -> builtins.str:
        """
        Topic 级别的参数配置。Parameters 参数说明 MinInsyncReplicaNumber:2：最小同步副本个数。当同步副本个数小于配置值时，消息将无法写入对应 Topic。配置值越大，数据可靠性增加，但是可用性将会降低。默认值为副本数减 1。考虑到 Topic 的可用性，建议设置为副本数减 1。MessageMaxByte:12：最大消息大小。单位为 MB，取值范围为 1～12。默认沿用实例的最大消息大小设置。LogRetentionHours:72：消息保留时长。单位为小时，取值范围为 0～2160，即消息最久保留 90 天。默认沿用实例的消息保留时长设置。
        """
        return pulumi.get(self, "parameters")

    @property
    @pulumi.getter(name="partitionNumber")
    def partition_number(self) -> builtins.int:
        """
        Topic 分区数。取值范围为 1~300，如果实例中已创建了其他 Topic，则所有 Topic 的分区数之和不超过该实例的分区数上限。如果分区数无法满足业务需求，您可以购买更多分区，提升实例的分区数量上限。
        """
        return pulumi.get(self, "partition_number")

    @property
    @pulumi.getter(name="replicaNumber")
    def replica_number(self) -> builtins.int:
        """
        Topic 副本个数。可设置为为 2 或 3，默认值为 3。
        """
        return pulumi.get(self, "replica_number")

    @property
    @pulumi.getter
    def status(self) -> builtins.str:
        """
        Topic 的状态。
        """
        return pulumi.get(self, "status")

    @property
    @pulumi.getter
    def tags(self) -> Sequence['outputs.GetTopicTagResult']:
        """
        Topic 的标签信息
        """
        return pulumi.get(self, "tags")

    @property
    @pulumi.getter(name="topicName")
    def topic_name(self) -> builtins.str:
        """
        待创建的 Topic 名称。3～64 个字符。必须以英文或数字开头。支持的字符包括英文、数字、连字符（-）、下划线（_）和英文句号（.）。
        """
        return pulumi.get(self, "topic_name")

    @property
    @pulumi.getter(name="usedStoragePercentageInInstance")
    def used_storage_percentage_in_instance(self) -> builtins.float:
        """
        当前 Topic 总数据量占实例总存储空间的比例，控制台页面显示为保留两位小数的百分数。
        """
        return pulumi.get(self, "used_storage_percentage_in_instance")

    @property
    @pulumi.getter(name="usedStorageSpaceInBytes")
    def used_storage_space_in_bytes(self) -> builtins.int:
        """
        当前 Topic 已使用的总存储空间大小。
        """
        return pulumi.get(self, "used_storage_space_in_bytes")


class AwaitableGetTopicResult(GetTopicResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetTopicResult(
            access_policies=self.access_policies,
            all_authority=self.all_authority,
            cleanup_policies=self.cleanup_policies,
            created_time=self.created_time,
            description=self.description,
            id=self.id,
            instance_id=self.instance_id,
            log_retention_hours=self.log_retention_hours,
            parameters=self.parameters,
            partition_number=self.partition_number,
            replica_number=self.replica_number,
            status=self.status,
            tags=self.tags,
            topic_name=self.topic_name,
            used_storage_percentage_in_instance=self.used_storage_percentage_in_instance,
            used_storage_space_in_bytes=self.used_storage_space_in_bytes)


def get_topic(id: Optional[builtins.str] = None,
              opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetTopicResult:
    """
    Data Source schema for Byteplus::Kafka::Topic


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('bytepluscc:kafka/getTopic:getTopic', __args__, opts=opts, typ=GetTopicResult).value

    return AwaitableGetTopicResult(
        access_policies=pulumi.get(__ret__, 'access_policies'),
        all_authority=pulumi.get(__ret__, 'all_authority'),
        cleanup_policies=pulumi.get(__ret__, 'cleanup_policies'),
        created_time=pulumi.get(__ret__, 'created_time'),
        description=pulumi.get(__ret__, 'description'),
        id=pulumi.get(__ret__, 'id'),
        instance_id=pulumi.get(__ret__, 'instance_id'),
        log_retention_hours=pulumi.get(__ret__, 'log_retention_hours'),
        parameters=pulumi.get(__ret__, 'parameters'),
        partition_number=pulumi.get(__ret__, 'partition_number'),
        replica_number=pulumi.get(__ret__, 'replica_number'),
        status=pulumi.get(__ret__, 'status'),
        tags=pulumi.get(__ret__, 'tags'),
        topic_name=pulumi.get(__ret__, 'topic_name'),
        used_storage_percentage_in_instance=pulumi.get(__ret__, 'used_storage_percentage_in_instance'),
        used_storage_space_in_bytes=pulumi.get(__ret__, 'used_storage_space_in_bytes'))
def get_topic_output(id: Optional[pulumi.Input[builtins.str]] = None,
                     opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetTopicResult]:
    """
    Data Source schema for Byteplus::Kafka::Topic


    :param builtins.str id: Uniquely identifies the resource.
    """
    __args__ = dict()
    __args__['id'] = id
    opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke_output('bytepluscc:kafka/getTopic:getTopic', __args__, opts=opts, typ=GetTopicResult)
    return __ret__.apply(lambda __response__: GetTopicResult(
        access_policies=pulumi.get(__response__, 'access_policies'),
        all_authority=pulumi.get(__response__, 'all_authority'),
        cleanup_policies=pulumi.get(__response__, 'cleanup_policies'),
        created_time=pulumi.get(__response__, 'created_time'),
        description=pulumi.get(__response__, 'description'),
        id=pulumi.get(__response__, 'id'),
        instance_id=pulumi.get(__response__, 'instance_id'),
        log_retention_hours=pulumi.get(__response__, 'log_retention_hours'),
        parameters=pulumi.get(__response__, 'parameters'),
        partition_number=pulumi.get(__response__, 'partition_number'),
        replica_number=pulumi.get(__response__, 'replica_number'),
        status=pulumi.get(__response__, 'status'),
        tags=pulumi.get(__response__, 'tags'),
        topic_name=pulumi.get(__response__, 'topic_name'),
        used_storage_percentage_in_instance=pulumi.get(__response__, 'used_storage_percentage_in_instance'),
        used_storage_space_in_bytes=pulumi.get(__response__, 'used_storage_space_in_bytes')))
