# 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 Union
from .. import utilities, tables


class PolicySetDefinition(pulumi.CustomResource):
    description: pulumi.Output[str]
    """
    The description of the policy set definition.
    """
    display_name: pulumi.Output[str]
    """
    The display name of the policy set definition.
    """
    management_group_id: pulumi.Output[str]
    """
    The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
    """
    management_group_name: pulumi.Output[str]
    """
    The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
    """
    metadata: pulumi.Output[str]
    """
    The metadata for the policy set definition. This is a json object representing additional metadata that should be stored with the policy definition.
    """
    name: pulumi.Output[str]
    """
    The name of the policy set definition. Changing this forces a new resource to be created.
    """
    parameters: pulumi.Output[str]
    """
    Parameters for the policy set definition. This field is a json object that allows you to parameterize your policy definition.
    """
    policy_definition_references: pulumi.Output[list]
    """
    One or more `policy_definition_reference` blocks as defined below.

      * `parameters` (`dict`) - A mapping of the parameter values for the referenced policy rule. The keys are the parameter names.
      * `policy_definition_id` (`str`) - The ID of the policy definition or policy set definition that will be included in this policy set definition.
      * `referenceId` (`str`) - A unique ID within this policy set definition for this policy definition reference.
    """
    policy_definitions: pulumi.Output[str]
    """
    The policy definitions for the policy set definition. This is a json object representing the bundled policy definitions.
    """
    policy_type: pulumi.Output[str]
    """
    The policy set type. Possible values are `BuiltIn` or `Custom`. Changing this forces a new resource to be created.
    """
    def __init__(__self__, resource_name, opts=None, description=None, display_name=None, management_group_id=None, management_group_name=None, metadata=None, name=None, parameters=None, policy_definition_references=None, policy_definitions=None, policy_type=None, __props__=None, __name__=None, __opts__=None):
        """
        Manages a policy set definition.

        > **NOTE:**  Policy set definitions (also known as policy initiatives) do not take effect until they are assigned to a scope using a Policy Set Assignment.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        example = azure.policy.PolicySetDefinition("example",
            display_name="Test Policy Set",
            parameters=\"\"\"    {
                "allowedLocations": {
                    "type": "Array",
                    "metadata": {
                        "description": "The list of allowed locations for resources.",
                        "displayName": "Allowed locations",
                        "strongType": "location"
                    }
                }
            }

        \"\"\",
            policy_definition_references=[{
                "parameters": {
                    "listOfAllowedLocations": "[parameters('allowedLocations')]",
                },
                "policy_definition_id": "/providers/Microsoft.Authorization/policyDefinitions/e765b5de-1225-4ba3-bd56-1ac6695af988",
            }],
            policy_type="Custom")
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: The description of the policy set definition.
        :param pulumi.Input[str] display_name: The display name of the policy set definition.
        :param pulumi.Input[str] management_group_id: The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
        :param pulumi.Input[str] management_group_name: The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
        :param pulumi.Input[str] metadata: The metadata for the policy set definition. This is a json object representing additional metadata that should be stored with the policy definition.
        :param pulumi.Input[str] name: The name of the policy set definition. Changing this forces a new resource to be created.
        :param pulumi.Input[str] parameters: Parameters for the policy set definition. This field is a json object that allows you to parameterize your policy definition.
        :param pulumi.Input[list] policy_definition_references: One or more `policy_definition_reference` blocks as defined below.
        :param pulumi.Input[str] policy_definitions: The policy definitions for the policy set definition. This is a json object representing the bundled policy definitions.
        :param pulumi.Input[str] policy_type: The policy set type. Possible values are `BuiltIn` or `Custom`. Changing this forces a new resource to be created.

        The **policy_definition_references** object supports the following:

          * `parameters` (`pulumi.Input[dict]`) - A mapping of the parameter values for the referenced policy rule. The keys are the parameter names.
          * `policy_definition_id` (`pulumi.Input[str]`) - The ID of the policy definition or policy set definition that will be included in this policy set definition.
          * `referenceId` (`pulumi.Input[str]`) - A unique ID within this policy set definition for this policy definition reference.
        """
        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__['description'] = description
            if display_name is None:
                raise TypeError("Missing required property 'display_name'")
            __props__['display_name'] = display_name
            if management_group_id is not None:
                warnings.warn("Deprecated in favour of `management_group_name`", DeprecationWarning)
                pulumi.log.warn("management_group_id is deprecated: Deprecated in favour of `management_group_name`")
            __props__['management_group_id'] = management_group_id
            __props__['management_group_name'] = management_group_name
            __props__['metadata'] = metadata
            __props__['name'] = name
            __props__['parameters'] = parameters
            __props__['policy_definition_references'] = policy_definition_references
            if policy_definitions is not None:
                warnings.warn("Deprecated in favor of `policy_definition_reference`", DeprecationWarning)
                pulumi.log.warn("policy_definitions is deprecated: Deprecated in favor of `policy_definition_reference`")
            __props__['policy_definitions'] = policy_definitions
            if policy_type is None:
                raise TypeError("Missing required property 'policy_type'")
            __props__['policy_type'] = policy_type
        super(PolicySetDefinition, __self__).__init__(
            'azure:policy/policySetDefinition:PolicySetDefinition',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, description=None, display_name=None, management_group_id=None, management_group_name=None, metadata=None, name=None, parameters=None, policy_definition_references=None, policy_definitions=None, policy_type=None):
        """
        Get an existing PolicySetDefinition 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 str id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[str] description: The description of the policy set definition.
        :param pulumi.Input[str] display_name: The display name of the policy set definition.
        :param pulumi.Input[str] management_group_id: The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
        :param pulumi.Input[str] management_group_name: The name of the Management Group where this policy set definition should be defined. Changing this forces a new resource to be created.
        :param pulumi.Input[str] metadata: The metadata for the policy set definition. This is a json object representing additional metadata that should be stored with the policy definition.
        :param pulumi.Input[str] name: The name of the policy set definition. Changing this forces a new resource to be created.
        :param pulumi.Input[str] parameters: Parameters for the policy set definition. This field is a json object that allows you to parameterize your policy definition.
        :param pulumi.Input[list] policy_definition_references: One or more `policy_definition_reference` blocks as defined below.
        :param pulumi.Input[str] policy_definitions: The policy definitions for the policy set definition. This is a json object representing the bundled policy definitions.
        :param pulumi.Input[str] policy_type: The policy set type. Possible values are `BuiltIn` or `Custom`. Changing this forces a new resource to be created.

        The **policy_definition_references** object supports the following:

          * `parameters` (`pulumi.Input[dict]`) - A mapping of the parameter values for the referenced policy rule. The keys are the parameter names.
          * `policy_definition_id` (`pulumi.Input[str]`) - The ID of the policy definition or policy set definition that will be included in this policy set definition.
          * `referenceId` (`pulumi.Input[str]`) - A unique ID within this policy set definition for this policy definition reference.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["description"] = description
        __props__["display_name"] = display_name
        __props__["management_group_id"] = management_group_id
        __props__["management_group_name"] = management_group_name
        __props__["metadata"] = metadata
        __props__["name"] = name
        __props__["parameters"] = parameters
        __props__["policy_definition_references"] = policy_definition_references
        __props__["policy_definitions"] = policy_definitions
        __props__["policy_type"] = policy_type
        return PolicySetDefinition(resource_name, opts=opts, __props__=__props__)

    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
