# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
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
from ._inputs import *

__all__ = ['TagPolicyArgs', 'TagPolicy']

@pulumi.input_type
class TagPolicyArgs:
    def __init__(__self__, *,
                 tag_key: pulumi.Input[_builtins.str],
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input['TagPolicyProviderConfigArgs']] = None,
                 values: Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]] = None):
        """
        The set of arguments for constructing a TagPolicy resource.
        :param pulumi.Input['TagPolicyProviderConfigArgs'] provider_config: Configure the provider for management through account provider.
        """
        pulumi.set(__self__, "tag_key", tag_key)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)
        if values is not None:
            pulumi.set(__self__, "values", values)

    @_builtins.property
    @pulumi.getter(name="tagKey")
    def tag_key(self) -> pulumi.Input[_builtins.str]:
        return pulumi.get(self, "tag_key")

    @tag_key.setter
    def tag_key(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "tag_key", value)

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "description", value)

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['TagPolicyProviderConfigArgs']]:
        """
        Configure the provider for management through account provider.
        """
        return pulumi.get(self, "provider_config")

    @provider_config.setter
    def provider_config(self, value: Optional[pulumi.Input['TagPolicyProviderConfigArgs']]):
        pulumi.set(self, "provider_config", value)

    @_builtins.property
    @pulumi.getter
    def values(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]]:
        return pulumi.get(self, "values")

    @values.setter
    def values(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]]):
        pulumi.set(self, "values", value)


@pulumi.input_type
class _TagPolicyState:
    def __init__(__self__, *,
                 create_time: Optional[pulumi.Input[_builtins.str]] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input['TagPolicyProviderConfigArgs']] = None,
                 tag_key: Optional[pulumi.Input[_builtins.str]] = None,
                 update_time: Optional[pulumi.Input[_builtins.str]] = None,
                 values: Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]] = None):
        """
        Input properties used for looking up and filtering TagPolicy resources.
        :param pulumi.Input[_builtins.str] create_time: (string) - Timestamp when the tag policy was created
        :param pulumi.Input['TagPolicyProviderConfigArgs'] provider_config: Configure the provider for management through account provider.
        :param pulumi.Input[_builtins.str] update_time: (string) - Timestamp when the tag policy was last updated
        """
        if create_time is not None:
            pulumi.set(__self__, "create_time", create_time)
        if description is not None:
            pulumi.set(__self__, "description", description)
        if provider_config is not None:
            pulumi.set(__self__, "provider_config", provider_config)
        if tag_key is not None:
            pulumi.set(__self__, "tag_key", tag_key)
        if update_time is not None:
            pulumi.set(__self__, "update_time", update_time)
        if values is not None:
            pulumi.set(__self__, "values", values)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - Timestamp when the tag policy was created
        """
        return pulumi.get(self, "create_time")

    @create_time.setter
    def create_time(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "create_time", value)

    @_builtins.property
    @pulumi.getter
    def description(self) -> Optional[pulumi.Input[_builtins.str]]:
        return pulumi.get(self, "description")

    @description.setter
    def description(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "description", value)

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> Optional[pulumi.Input['TagPolicyProviderConfigArgs']]:
        """
        Configure the provider for management through account provider.
        """
        return pulumi.get(self, "provider_config")

    @provider_config.setter
    def provider_config(self, value: Optional[pulumi.Input['TagPolicyProviderConfigArgs']]):
        pulumi.set(self, "provider_config", value)

    @_builtins.property
    @pulumi.getter(name="tagKey")
    def tag_key(self) -> Optional[pulumi.Input[_builtins.str]]:
        return pulumi.get(self, "tag_key")

    @tag_key.setter
    def tag_key(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "tag_key", value)

    @_builtins.property
    @pulumi.getter(name="updateTime")
    def update_time(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        (string) - Timestamp when the tag policy was last updated
        """
        return pulumi.get(self, "update_time")

    @update_time.setter
    def update_time(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "update_time", value)

    @_builtins.property
    @pulumi.getter
    def values(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]]:
        return pulumi.get(self, "values")

    @values.setter
    def values(self, value: Optional[pulumi.Input[Sequence[pulumi.Input['TagPolicyValueArgs']]]]):
        pulumi.set(self, "values", value)


@pulumi.type_token("databricks:index/tagPolicy:TagPolicy")
class TagPolicy(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input[Union['TagPolicyProviderConfigArgs', 'TagPolicyProviderConfigArgsDict']]] = None,
                 tag_key: Optional[pulumi.Input[_builtins.str]] = None,
                 values: Optional[pulumi.Input[Sequence[pulumi.Input[Union['TagPolicyValueArgs', 'TagPolicyValueArgsDict']]]]] = None,
                 __props__=None):
        """
        [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

        Define tag policies to manage governed tags in your account.

        The following resources are often used in the same context:

        * EntityTagAssignment for assigning tags to supported Unity Catalog entities.
        * WorkspaceEntityTagAssignment for assigning tags to supported workspace entities.
        * PolicyInfo for defining ABAC policies using governed tags.
        * AccessControlRuleSet for managing account-level and individual tag policy permissions.

        > **Note** This resource can only be used with a workspace-level provider!

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        example_tag_policy = databricks.TagPolicy("example_tag_policy",
            tag_key="example_tag_key",
            description="Example description.",
            values=[
                {
                    "name": "example_value_1",
                },
                {
                    "name": "example_value_2",
                },
                {
                    "name": "example_value_3",
                },
            ])
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[Union['TagPolicyProviderConfigArgs', 'TagPolicyProviderConfigArgsDict']] provider_config: Configure the provider for management through account provider.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: TagPolicyArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        [![Public Preview](https://img.shields.io/badge/Release_Stage-Public_Preview-yellowgreen)](https://docs.databricks.com/aws/en/release-notes/release-types)

        Define tag policies to manage governed tags in your account.

        The following resources are often used in the same context:

        * EntityTagAssignment for assigning tags to supported Unity Catalog entities.
        * WorkspaceEntityTagAssignment for assigning tags to supported workspace entities.
        * PolicyInfo for defining ABAC policies using governed tags.
        * AccessControlRuleSet for managing account-level and individual tag policy permissions.

        > **Note** This resource can only be used with a workspace-level provider!

        ## Example Usage

        ```python
        import pulumi
        import pulumi_databricks as databricks

        example_tag_policy = databricks.TagPolicy("example_tag_policy",
            tag_key="example_tag_key",
            description="Example description.",
            values=[
                {
                    "name": "example_value_1",
                },
                {
                    "name": "example_value_2",
                },
                {
                    "name": "example_value_3",
                },
            ])
        ```

        :param str resource_name: The name of the resource.
        :param TagPolicyArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(TagPolicyArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 description: Optional[pulumi.Input[_builtins.str]] = None,
                 provider_config: Optional[pulumi.Input[Union['TagPolicyProviderConfigArgs', 'TagPolicyProviderConfigArgsDict']]] = None,
                 tag_key: Optional[pulumi.Input[_builtins.str]] = None,
                 values: Optional[pulumi.Input[Sequence[pulumi.Input[Union['TagPolicyValueArgs', 'TagPolicyValueArgsDict']]]]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        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__ = TagPolicyArgs.__new__(TagPolicyArgs)

            __props__.__dict__["description"] = description
            __props__.__dict__["provider_config"] = provider_config
            if tag_key is None and not opts.urn:
                raise TypeError("Missing required property 'tag_key'")
            __props__.__dict__["tag_key"] = tag_key
            __props__.__dict__["values"] = values
            __props__.__dict__["create_time"] = None
            __props__.__dict__["update_time"] = None
        super(TagPolicy, __self__).__init__(
            'databricks:index/tagPolicy:TagPolicy',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None,
            create_time: Optional[pulumi.Input[_builtins.str]] = None,
            description: Optional[pulumi.Input[_builtins.str]] = None,
            provider_config: Optional[pulumi.Input[Union['TagPolicyProviderConfigArgs', 'TagPolicyProviderConfigArgsDict']]] = None,
            tag_key: Optional[pulumi.Input[_builtins.str]] = None,
            update_time: Optional[pulumi.Input[_builtins.str]] = None,
            values: Optional[pulumi.Input[Sequence[pulumi.Input[Union['TagPolicyValueArgs', 'TagPolicyValueArgsDict']]]]] = None) -> 'TagPolicy':
        """
        Get an existing TagPolicy 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[_builtins.str] create_time: (string) - Timestamp when the tag policy was created
        :param pulumi.Input[Union['TagPolicyProviderConfigArgs', 'TagPolicyProviderConfigArgsDict']] provider_config: Configure the provider for management through account provider.
        :param pulumi.Input[_builtins.str] update_time: (string) - Timestamp when the tag policy was last updated
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = _TagPolicyState.__new__(_TagPolicyState)

        __props__.__dict__["create_time"] = create_time
        __props__.__dict__["description"] = description
        __props__.__dict__["provider_config"] = provider_config
        __props__.__dict__["tag_key"] = tag_key
        __props__.__dict__["update_time"] = update_time
        __props__.__dict__["values"] = values
        return TagPolicy(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="createTime")
    def create_time(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - Timestamp when the tag policy was created
        """
        return pulumi.get(self, "create_time")

    @_builtins.property
    @pulumi.getter
    def description(self) -> pulumi.Output[Optional[_builtins.str]]:
        return pulumi.get(self, "description")

    @_builtins.property
    @pulumi.getter(name="providerConfig")
    def provider_config(self) -> pulumi.Output[Optional['outputs.TagPolicyProviderConfig']]:
        """
        Configure the provider for management through account provider.
        """
        return pulumi.get(self, "provider_config")

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

    @_builtins.property
    @pulumi.getter(name="updateTime")
    def update_time(self) -> pulumi.Output[_builtins.str]:
        """
        (string) - Timestamp when the tag policy was last updated
        """
        return pulumi.get(self, "update_time")

    @_builtins.property
    @pulumi.getter
    def values(self) -> pulumi.Output[Optional[Sequence['outputs.TagPolicyValue']]]:
        return pulumi.get(self, "values")

