# 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 copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import _utilities

__all__ = [
    'GetClusterPolicyResult',
    'AwaitableGetClusterPolicyResult',
    'get_cluster_policy',
    'get_cluster_policy_output',
]

@pulumi.output_type
class GetClusterPolicyResult:
    """
    A collection of values returned by getClusterPolicy.
    """
    def __init__(__self__, definition=None, description=None, id=None, is_default=None, max_clusters_per_user=None, name=None, policy_family_definition_overrides=None, policy_family_id=None):
        if definition and not isinstance(definition, str):
            raise TypeError("Expected argument 'definition' to be a str")
        pulumi.set(__self__, "definition", definition)
        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_default and not isinstance(is_default, bool):
            raise TypeError("Expected argument 'is_default' to be a bool")
        pulumi.set(__self__, "is_default", is_default)
        if max_clusters_per_user and not isinstance(max_clusters_per_user, int):
            raise TypeError("Expected argument 'max_clusters_per_user' to be a int")
        pulumi.set(__self__, "max_clusters_per_user", max_clusters_per_user)
        if name and not isinstance(name, str):
            raise TypeError("Expected argument 'name' to be a str")
        pulumi.set(__self__, "name", name)
        if policy_family_definition_overrides and not isinstance(policy_family_definition_overrides, str):
            raise TypeError("Expected argument 'policy_family_definition_overrides' to be a str")
        pulumi.set(__self__, "policy_family_definition_overrides", policy_family_definition_overrides)
        if policy_family_id and not isinstance(policy_family_id, str):
            raise TypeError("Expected argument 'policy_family_id' to be a str")
        pulumi.set(__self__, "policy_family_id", policy_family_id)

    @property
    @pulumi.getter
    def definition(self) -> str:
        """
        Policy definition: JSON document expressed in [Databricks Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definition).
        """
        return pulumi.get(self, "definition")

    @property
    @pulumi.getter
    def description(self) -> str:
        """
        Additional human-readable description of the cluster policy.
        """
        return pulumi.get(self, "description")

    @property
    @pulumi.getter
    def id(self) -> str:
        """
        The id of the cluster policy.
        """
        return pulumi.get(self, "id")

    @property
    @pulumi.getter(name="isDefault")
    def is_default(self) -> bool:
        """
        If true, policy is a default policy created and managed by Databricks.
        """
        return pulumi.get(self, "is_default")

    @property
    @pulumi.getter(name="maxClustersPerUser")
    def max_clusters_per_user(self) -> int:
        """
        Max number of clusters per user that can be active using this policy.
        """
        return pulumi.get(self, "max_clusters_per_user")

    @property
    @pulumi.getter
    def name(self) -> str:
        return pulumi.get(self, "name")

    @property
    @pulumi.getter(name="policyFamilyDefinitionOverrides")
    def policy_family_definition_overrides(self) -> str:
        """
        Policy definition JSON document expressed in Databricks [Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definitions).
        """
        return pulumi.get(self, "policy_family_definition_overrides")

    @property
    @pulumi.getter(name="policyFamilyId")
    def policy_family_id(self) -> str:
        """
        ID of the policy family.
        """
        return pulumi.get(self, "policy_family_id")


class AwaitableGetClusterPolicyResult(GetClusterPolicyResult):
    # pylint: disable=using-constant-test
    def __await__(self):
        if False:
            yield self
        return GetClusterPolicyResult(
            definition=self.definition,
            description=self.description,
            id=self.id,
            is_default=self.is_default,
            max_clusters_per_user=self.max_clusters_per_user,
            name=self.name,
            policy_family_definition_overrides=self.policy_family_definition_overrides,
            policy_family_id=self.policy_family_id)


def get_cluster_policy(definition: Optional[str] = None,
                       description: Optional[str] = None,
                       id: Optional[str] = None,
                       is_default: Optional[bool] = None,
                       max_clusters_per_user: Optional[int] = None,
                       name: Optional[str] = None,
                       policy_family_definition_overrides: Optional[str] = None,
                       policy_family_id: Optional[str] = None,
                       opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetClusterPolicyResult:
    """
    > **Note** If you have a fully automated setup with workspaces created by databricks_mws_workspaces, please make sure to add depends_on attribute in order to prevent _default auth: cannot configure default credentials_ errors.

    Retrieves information about databricks_cluster_policy.

    ## Example Usage

    Referring to a cluster policy by name:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    personal = databricks.get_cluster_policy(name="Personal Compute")
    my_cluster = databricks.Cluster("my_cluster", policy_id=personal.id)
    ```


    :param str definition: Policy definition: JSON document expressed in [Databricks Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definition).
    :param str description: Additional human-readable description of the cluster policy.
    :param str id: The id of the cluster policy.
    :param bool is_default: If true, policy is a default policy created and managed by Databricks.
    :param int max_clusters_per_user: Max number of clusters per user that can be active using this policy.
    :param str name: Name of the cluster policy. The cluster policy must exist before this resource can be planned.
    :param str policy_family_definition_overrides: Policy definition JSON document expressed in Databricks [Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definitions).
    :param str policy_family_id: ID of the policy family.
    """
    __args__ = dict()
    __args__['definition'] = definition
    __args__['description'] = description
    __args__['id'] = id
    __args__['isDefault'] = is_default
    __args__['maxClustersPerUser'] = max_clusters_per_user
    __args__['name'] = name
    __args__['policyFamilyDefinitionOverrides'] = policy_family_definition_overrides
    __args__['policyFamilyId'] = policy_family_id
    opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
    __ret__ = pulumi.runtime.invoke('databricks:index/getClusterPolicy:getClusterPolicy', __args__, opts=opts, typ=GetClusterPolicyResult).value

    return AwaitableGetClusterPolicyResult(
        definition=pulumi.get(__ret__, 'definition'),
        description=pulumi.get(__ret__, 'description'),
        id=pulumi.get(__ret__, 'id'),
        is_default=pulumi.get(__ret__, 'is_default'),
        max_clusters_per_user=pulumi.get(__ret__, 'max_clusters_per_user'),
        name=pulumi.get(__ret__, 'name'),
        policy_family_definition_overrides=pulumi.get(__ret__, 'policy_family_definition_overrides'),
        policy_family_id=pulumi.get(__ret__, 'policy_family_id'))


@_utilities.lift_output_func(get_cluster_policy)
def get_cluster_policy_output(definition: Optional[pulumi.Input[Optional[str]]] = None,
                              description: Optional[pulumi.Input[Optional[str]]] = None,
                              id: Optional[pulumi.Input[Optional[str]]] = None,
                              is_default: Optional[pulumi.Input[Optional[bool]]] = None,
                              max_clusters_per_user: Optional[pulumi.Input[Optional[int]]] = None,
                              name: Optional[pulumi.Input[Optional[str]]] = None,
                              policy_family_definition_overrides: Optional[pulumi.Input[Optional[str]]] = None,
                              policy_family_id: Optional[pulumi.Input[Optional[str]]] = None,
                              opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetClusterPolicyResult]:
    """
    > **Note** If you have a fully automated setup with workspaces created by databricks_mws_workspaces, please make sure to add depends_on attribute in order to prevent _default auth: cannot configure default credentials_ errors.

    Retrieves information about databricks_cluster_policy.

    ## Example Usage

    Referring to a cluster policy by name:

    ```python
    import pulumi
    import pulumi_databricks as databricks

    personal = databricks.get_cluster_policy(name="Personal Compute")
    my_cluster = databricks.Cluster("my_cluster", policy_id=personal.id)
    ```


    :param str definition: Policy definition: JSON document expressed in [Databricks Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definition).
    :param str description: Additional human-readable description of the cluster policy.
    :param str id: The id of the cluster policy.
    :param bool is_default: If true, policy is a default policy created and managed by Databricks.
    :param int max_clusters_per_user: Max number of clusters per user that can be active using this policy.
    :param str name: Name of the cluster policy. The cluster policy must exist before this resource can be planned.
    :param str policy_family_definition_overrides: Policy definition JSON document expressed in Databricks [Policy Definition Language](https://docs.databricks.com/administration-guide/clusters/policies.html#cluster-policy-definitions).
    :param str policy_family_id: ID of the policy family.
    """
    ...
