# 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__ = [
    'GetPolicyResult',
    'AwaitableGetPolicyResult',
    'get_policy',
    'get_policy_output',
]

@pulumi.output_type
class GetPolicyResult:
    """
    A collection of values returned by getPolicy.
    """
    def __init__(__self__, attachment_count=None, category=None, created_time=None, description=None, id=None, is_service_role_policy=None, policy_document=None, policy_name=None, policy_roles=None, policy_trn=None, policy_type=None, policy_user_groups=None, policy_users=None, updated_time=None):
        if attachment_count and not isinstance(attachment_count, int):
            raise TypeError("Expected argument 'attachment_count' to be a int")
        pulumi.set(__self__, "attachment_count", attachment_count)
        if category and not isinstance(category, str):
            raise TypeError("Expected argument 'category' to be a str")
        pulumi.set(__self__, "category", category)
        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 is_service_role_policy and not isinstance(is_service_role_policy, int):
            raise TypeError("Expected argument 'is_service_role_policy' to be a int")
        pulumi.set(__self__, "is_service_role_policy", is_service_role_policy)
        if policy_document and not isinstance(policy_document, str):
            raise TypeError("Expected argument 'policy_document' to be a str")
        pulumi.set(__self__, "policy_document", policy_document)
        if policy_name and not isinstance(policy_name, str):
            raise TypeError("Expected argument 'policy_name' to be a str")
        pulumi.set(__self__, "policy_name", policy_name)
        if policy_roles and not isinstance(policy_roles, list):
            raise TypeError("Expected argument 'policy_roles' to be a list")
        pulumi.set(__self__, "policy_roles", policy_roles)
        if policy_trn and not isinstance(policy_trn, str):
            raise TypeError("Expected argument 'policy_trn' to be a str")
        pulumi.set(__self__, "policy_trn", policy_trn)
        if policy_type and not isinstance(policy_type, str):
            raise TypeError("Expected argument 'policy_type' to be a str")
        pulumi.set(__self__, "policy_type", policy_type)
        if policy_user_groups and not isinstance(policy_user_groups, list):
            raise TypeError("Expected argument 'policy_user_groups' to be a list")
        pulumi.set(__self__, "policy_user_groups", policy_user_groups)
        if policy_users and not isinstance(policy_users, list):
            raise TypeError("Expected argument 'policy_users' to be a list")
        pulumi.set(__self__, "policy_users", policy_users)
        if updated_time and not isinstance(updated_time, str):
            raise TypeError("Expected argument 'updated_time' to be a str")
        pulumi.set(__self__, "updated_time", updated_time)

    @property
    @pulumi.getter(name="attachmentCount")
    def attachment_count(self) -> builtins.int:
        """
        策略绑定的身份数量。
        """
        return pulumi.get(self, "attachment_count")

    @property
    @pulumi.getter
    def category(self) -> builtins.str:
        """
        系统预设策略所属的分类，通常为服务代码，对于自定义策略该字段不会返回值。
        """
        return pulumi.get(self, "category")

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

    @property
    @pulumi.getter
    def description(self) -> builtins.str:
        """
        策略描述，长度不超过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="isServiceRolePolicy")
    def is_service_role_policy(self) -> builtins.int:
        """
        是否是服务关联角色的策略，0代表否，1代表是。
        """
        return pulumi.get(self, "is_service_role_policy")

    @property
    @pulumi.getter(name="policyDocument")
    def policy_document(self) -> builtins.str:
        """
        策略语法内容，例如：{"Statement":[{"Effect":"Allow","Action":["iam:","tag:"],"Resource":["*"]}]}
        """
        return pulumi.get(self, "policy_document")

    @property
    @pulumi.getter(name="policyName")
    def policy_name(self) -> builtins.str:
        """
        策略名，长度1~64，支持英文、数字和+=,.@-_符号。
        """
        return pulumi.get(self, "policy_name")

    @property
    @pulumi.getter(name="policyRoles")
    def policy_roles(self) -> Sequence['outputs.GetPolicyPolicyRoleResult']:
        """
        策略绑定的角色列表。
        """
        return pulumi.get(self, "policy_roles")

    @property
    @pulumi.getter(name="policyTrn")
    def policy_trn(self) -> builtins.str:
        """
        策略的TRN。
        """
        return pulumi.get(self, "policy_trn")

    @property
    @pulumi.getter(name="policyType")
    def policy_type(self) -> builtins.str:
        """
        策略类型。System代表系统预设策略，Custom代表自定义策略。
        """
        return pulumi.get(self, "policy_type")

    @property
    @pulumi.getter(name="policyUserGroups")
    def policy_user_groups(self) -> Sequence['outputs.GetPolicyPolicyUserGroupResult']:
        """
        策略绑定的用户组列表。
        """
        return pulumi.get(self, "policy_user_groups")

    @property
    @pulumi.getter(name="policyUsers")
    def policy_users(self) -> Sequence['outputs.GetPolicyPolicyUserResult']:
        """
        策略绑定的用户列表。
        """
        return pulumi.get(self, "policy_users")

    @property
    @pulumi.getter(name="updatedTime")
    def updated_time(self) -> builtins.str:
        """
        策略更新时间。
        """
        return pulumi.get(self, "updated_time")


class AwaitableGetPolicyResult(GetPolicyResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetPolicyResult(
            attachment_count=self.attachment_count,
            category=self.category,
            created_time=self.created_time,
            description=self.description,
            id=self.id,
            is_service_role_policy=self.is_service_role_policy,
            policy_document=self.policy_document,
            policy_name=self.policy_name,
            policy_roles=self.policy_roles,
            policy_trn=self.policy_trn,
            policy_type=self.policy_type,
            policy_user_groups=self.policy_user_groups,
            policy_users=self.policy_users,
            updated_time=self.updated_time)


def get_policy(id: Optional[builtins.str] = None,
               opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetPolicyResult:
    """
    Data Source schema for Byteplus::IAM::Policy


    :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:iam/getPolicy:getPolicy', __args__, opts=opts, typ=GetPolicyResult).value

    return AwaitableGetPolicyResult(
        attachment_count=pulumi.get(__ret__, 'attachment_count'),
        category=pulumi.get(__ret__, 'category'),
        created_time=pulumi.get(__ret__, 'created_time'),
        description=pulumi.get(__ret__, 'description'),
        id=pulumi.get(__ret__, 'id'),
        is_service_role_policy=pulumi.get(__ret__, 'is_service_role_policy'),
        policy_document=pulumi.get(__ret__, 'policy_document'),
        policy_name=pulumi.get(__ret__, 'policy_name'),
        policy_roles=pulumi.get(__ret__, 'policy_roles'),
        policy_trn=pulumi.get(__ret__, 'policy_trn'),
        policy_type=pulumi.get(__ret__, 'policy_type'),
        policy_user_groups=pulumi.get(__ret__, 'policy_user_groups'),
        policy_users=pulumi.get(__ret__, 'policy_users'),
        updated_time=pulumi.get(__ret__, 'updated_time'))
def get_policy_output(id: Optional[pulumi.Input[builtins.str]] = None,
                      opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetPolicyResult]:
    """
    Data Source schema for Byteplus::IAM::Policy


    :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:iam/getPolicy:getPolicy', __args__, opts=opts, typ=GetPolicyResult)
    return __ret__.apply(lambda __response__: GetPolicyResult(
        attachment_count=pulumi.get(__response__, 'attachment_count'),
        category=pulumi.get(__response__, 'category'),
        created_time=pulumi.get(__response__, 'created_time'),
        description=pulumi.get(__response__, 'description'),
        id=pulumi.get(__response__, 'id'),
        is_service_role_policy=pulumi.get(__response__, 'is_service_role_policy'),
        policy_document=pulumi.get(__response__, 'policy_document'),
        policy_name=pulumi.get(__response__, 'policy_name'),
        policy_roles=pulumi.get(__response__, 'policy_roles'),
        policy_trn=pulumi.get(__response__, 'policy_trn'),
        policy_type=pulumi.get(__response__, 'policy_type'),
        policy_user_groups=pulumi.get(__response__, 'policy_user_groups'),
        policy_users=pulumi.get(__response__, 'policy_users'),
        updated_time=pulumi.get(__response__, 'updated_time')))
