# 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 KeyVault(pulumi.CustomResource):
    access_policies: pulumi.Output[list]
    """
    A list of up to 16 objects describing access policies, as described below.

      * `application_id` (`str`) - The object ID of an Application in Azure Active Directory.
      * `certificate_permissions` (`list`) - List of certificate permissions, must be one or more from the following: `backup`, `create`, `delete`, `deleteissuers`, `get`, `getissuers`, `import`, `list`, `listissuers`, `managecontacts`, `manageissuers`, `purge`, `recover`, `restore`, `setissuers` and `update`.
      * `key_permissions` (`list`) - List of key permissions, must be one or more from the following: `backup`, `create`, `decrypt`, `delete`, `encrypt`, `get`, `import`, `list`, `purge`, `recover`, `restore`, `sign`, `unwrapKey`, `update`, `verify` and `wrapKey`.
      * `object_id` (`str`) - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies.
      * `secret_permissions` (`list`) - List of secret permissions, must be one or more from the following: `backup`, `delete`, `get`, `list`, `purge`, `recover`, `restore` and `set`.
      * `storage_permissions` (`list`) - List of storage permissions, must be one or more from the following: `backup`, `delete`, `deletesas`, `get`, `getsas`, `list`, `listsas`, `purge`, `recover`, `regeneratekey`, `restore`, `set`, `setsas` and `update`.
      * `tenant_id` (`str`) - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. Must match the `tenant_id` used above.
    """
    enabled_for_deployment: pulumi.Output[bool]
    """
    Boolean flag to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. Defaults to `false`.
    """
    enabled_for_disk_encryption: pulumi.Output[bool]
    """
    Boolean flag to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. Defaults to `false`.
    """
    enabled_for_template_deployment: pulumi.Output[bool]
    """
    Boolean flag to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. Defaults to `false`.
    """
    location: pulumi.Output[str]
    """
    Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
    """
    name: pulumi.Output[str]
    """
    Specifies the name of the Key Vault. Changing this forces a new resource to be created.
    """
    network_acls: pulumi.Output[dict]
    """
    A `network_acls` block as defined below.

      * `bypass` (`str`) - Specifies which traffic can bypass the network rules. Possible values are `AzureServices` and `None`.
      * `default_action` (`str`) - The Default Action to use when no rules match from `ip_rules` / `virtual_network_subnet_ids`. Possible values are `Allow` and `Deny`.
      * `ip_rules` (`list`) - One or more IP Addresses, or CIDR Blocks which should be able to access the Key Vault.
      * `virtual_network_subnet_ids` (`list`) - One or more Subnet ID's which should be able to access this Key Vault.
    """
    purge_protection_enabled: pulumi.Output[bool]
    """
    Is Purge Protection enabled for this Key Vault? Defaults to `false`.
    """
    resource_group_name: pulumi.Output[str]
    """
    The name of the resource group in which to create the Key Vault. Changing this forces a new resource to be created.
    """
    sku_name: pulumi.Output[str]
    """
    The Name of the SKU used for this Key Vault. Possible values are `standard` and `premium`.
    """
    soft_delete_enabled: pulumi.Output[bool]
    """
    Should Soft Delete be enabled for this Key Vault? Defaults to `false`.
    """
    tags: pulumi.Output[dict]
    """
    A mapping of tags to assign to the resource.
    """
    tenant_id: pulumi.Output[str]
    """
    The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
    """
    vault_uri: pulumi.Output[str]
    """
    The URI of the Key Vault, used for performing operations on keys and secrets.
    """
    def __init__(__self__, resource_name, opts=None, access_policies=None, enabled_for_deployment=None, enabled_for_disk_encryption=None, enabled_for_template_deployment=None, location=None, name=None, network_acls=None, purge_protection_enabled=None, resource_group_name=None, sku_name=None, soft_delete_enabled=None, tags=None, tenant_id=None, __props__=None, __name__=None, __opts__=None):
        """
        Manages a Key Vault.

        ## Disclaimers

        > **Note:** It's possible to define Key Vault Access Policies both within the `keyvault.KeyVault` resource via the `access_policy` block and by using the `keyvault.AccessPolicy` resource. However it's not possible to use both methods to manage Access Policies within a KeyVault, since there'll be conflicts.

        > **Note:** This provi will automatically recover a soft-deleted Key Vault during Creation if one is found - you can opt out of this using the `features` configuration within the Provider configuration block.

        ## Example Usage

        ```python
        import pulumi
        import pulumi_azure as azure

        current = azure.core.get_client_config()
        example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West US")
        example_key_vault = azure.keyvault.KeyVault("exampleKeyVault",
            location=example_resource_group.location,
            resource_group_name=example_resource_group.name,
            enabled_for_disk_encryption=True,
            tenant_id=current.tenant_id,
            soft_delete_enabled=True,
            purge_protection_enabled=False,
            sku_name="standard",
            access_policies=[{
                "tenant_id": current.tenant_id,
                "object_id": current.object_id,
                "key_permissions": ["get"],
                "secret_permissions": ["get"],
                "storage_permissions": ["get"],
            }],
            network_acls={
                "default_action": "Deny",
                "bypass": "AzureServices",
            },
            tags={
                "environment": "Testing",
            })
        ```

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[list] access_policies: A list of up to 16 objects describing access policies, as described below.
        :param pulumi.Input[bool] enabled_for_deployment: Boolean flag to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. Defaults to `false`.
        :param pulumi.Input[bool] enabled_for_disk_encryption: Boolean flag to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. Defaults to `false`.
        :param pulumi.Input[bool] enabled_for_template_deployment: Boolean flag to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. Defaults to `false`.
        :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Key Vault. Changing this forces a new resource to be created.
        :param pulumi.Input[dict] network_acls: A `network_acls` block as defined below.
        :param pulumi.Input[bool] purge_protection_enabled: Is Purge Protection enabled for this Key Vault? Defaults to `false`.
        :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the Key Vault. Changing this forces a new resource to be created.
        :param pulumi.Input[str] sku_name: The Name of the SKU used for this Key Vault. Possible values are `standard` and `premium`.
        :param pulumi.Input[bool] soft_delete_enabled: Should Soft Delete be enabled for this Key Vault? Defaults to `false`.
        :param pulumi.Input[dict] tags: A mapping of tags to assign to the resource.
        :param pulumi.Input[str] tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.

        The **access_policies** object supports the following:

          * `application_id` (`pulumi.Input[str]`) - The object ID of an Application in Azure Active Directory.
          * `certificate_permissions` (`pulumi.Input[list]`) - List of certificate permissions, must be one or more from the following: `backup`, `create`, `delete`, `deleteissuers`, `get`, `getissuers`, `import`, `list`, `listissuers`, `managecontacts`, `manageissuers`, `purge`, `recover`, `restore`, `setissuers` and `update`.
          * `key_permissions` (`pulumi.Input[list]`) - List of key permissions, must be one or more from the following: `backup`, `create`, `decrypt`, `delete`, `encrypt`, `get`, `import`, `list`, `purge`, `recover`, `restore`, `sign`, `unwrapKey`, `update`, `verify` and `wrapKey`.
          * `object_id` (`pulumi.Input[str]`) - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies.
          * `secret_permissions` (`pulumi.Input[list]`) - List of secret permissions, must be one or more from the following: `backup`, `delete`, `get`, `list`, `purge`, `recover`, `restore` and `set`.
          * `storage_permissions` (`pulumi.Input[list]`) - List of storage permissions, must be one or more from the following: `backup`, `delete`, `deletesas`, `get`, `getsas`, `list`, `listsas`, `purge`, `recover`, `regeneratekey`, `restore`, `set`, `setsas` and `update`.
          * `tenant_id` (`pulumi.Input[str]`) - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. Must match the `tenant_id` used above.

        The **network_acls** object supports the following:

          * `bypass` (`pulumi.Input[str]`) - Specifies which traffic can bypass the network rules. Possible values are `AzureServices` and `None`.
          * `default_action` (`pulumi.Input[str]`) - The Default Action to use when no rules match from `ip_rules` / `virtual_network_subnet_ids`. Possible values are `Allow` and `Deny`.
          * `ip_rules` (`pulumi.Input[list]`) - One or more IP Addresses, or CIDR Blocks which should be able to access the Key Vault.
          * `virtual_network_subnet_ids` (`pulumi.Input[list]`) - One or more Subnet ID's which should be able to access this Key Vault.
        """
        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__['access_policies'] = access_policies
            __props__['enabled_for_deployment'] = enabled_for_deployment
            __props__['enabled_for_disk_encryption'] = enabled_for_disk_encryption
            __props__['enabled_for_template_deployment'] = enabled_for_template_deployment
            __props__['location'] = location
            __props__['name'] = name
            __props__['network_acls'] = network_acls
            __props__['purge_protection_enabled'] = purge_protection_enabled
            if resource_group_name is None:
                raise TypeError("Missing required property 'resource_group_name'")
            __props__['resource_group_name'] = resource_group_name
            if sku_name is None:
                raise TypeError("Missing required property 'sku_name'")
            __props__['sku_name'] = sku_name
            __props__['soft_delete_enabled'] = soft_delete_enabled
            __props__['tags'] = tags
            if tenant_id is None:
                raise TypeError("Missing required property 'tenant_id'")
            __props__['tenant_id'] = tenant_id
            __props__['vault_uri'] = None
        super(KeyVault, __self__).__init__(
            'azure:keyvault/keyVault:KeyVault',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name, id, opts=None, access_policies=None, enabled_for_deployment=None, enabled_for_disk_encryption=None, enabled_for_template_deployment=None, location=None, name=None, network_acls=None, purge_protection_enabled=None, resource_group_name=None, sku_name=None, soft_delete_enabled=None, tags=None, tenant_id=None, vault_uri=None):
        """
        Get an existing KeyVault 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[list] access_policies: A list of up to 16 objects describing access policies, as described below.
        :param pulumi.Input[bool] enabled_for_deployment: Boolean flag to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. Defaults to `false`.
        :param pulumi.Input[bool] enabled_for_disk_encryption: Boolean flag to specify whether Azure Disk Encryption is permitted to retrieve secrets from the vault and unwrap keys. Defaults to `false`.
        :param pulumi.Input[bool] enabled_for_template_deployment: Boolean flag to specify whether Azure Resource Manager is permitted to retrieve secrets from the key vault. Defaults to `false`.
        :param pulumi.Input[str] location: Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
        :param pulumi.Input[str] name: Specifies the name of the Key Vault. Changing this forces a new resource to be created.
        :param pulumi.Input[dict] network_acls: A `network_acls` block as defined below.
        :param pulumi.Input[bool] purge_protection_enabled: Is Purge Protection enabled for this Key Vault? Defaults to `false`.
        :param pulumi.Input[str] resource_group_name: The name of the resource group in which to create the Key Vault. Changing this forces a new resource to be created.
        :param pulumi.Input[str] sku_name: The Name of the SKU used for this Key Vault. Possible values are `standard` and `premium`.
        :param pulumi.Input[bool] soft_delete_enabled: Should Soft Delete be enabled for this Key Vault? Defaults to `false`.
        :param pulumi.Input[dict] tags: A mapping of tags to assign to the resource.
        :param pulumi.Input[str] tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault.
        :param pulumi.Input[str] vault_uri: The URI of the Key Vault, used for performing operations on keys and secrets.

        The **access_policies** object supports the following:

          * `application_id` (`pulumi.Input[str]`) - The object ID of an Application in Azure Active Directory.
          * `certificate_permissions` (`pulumi.Input[list]`) - List of certificate permissions, must be one or more from the following: `backup`, `create`, `delete`, `deleteissuers`, `get`, `getissuers`, `import`, `list`, `listissuers`, `managecontacts`, `manageissuers`, `purge`, `recover`, `restore`, `setissuers` and `update`.
          * `key_permissions` (`pulumi.Input[list]`) - List of key permissions, must be one or more from the following: `backup`, `create`, `decrypt`, `delete`, `encrypt`, `get`, `import`, `list`, `purge`, `recover`, `restore`, `sign`, `unwrapKey`, `update`, `verify` and `wrapKey`.
          * `object_id` (`pulumi.Input[str]`) - The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies.
          * `secret_permissions` (`pulumi.Input[list]`) - List of secret permissions, must be one or more from the following: `backup`, `delete`, `get`, `list`, `purge`, `recover`, `restore` and `set`.
          * `storage_permissions` (`pulumi.Input[list]`) - List of storage permissions, must be one or more from the following: `backup`, `delete`, `deletesas`, `get`, `getsas`, `list`, `listsas`, `purge`, `recover`, `regeneratekey`, `restore`, `set`, `setsas` and `update`.
          * `tenant_id` (`pulumi.Input[str]`) - The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. Must match the `tenant_id` used above.

        The **network_acls** object supports the following:

          * `bypass` (`pulumi.Input[str]`) - Specifies which traffic can bypass the network rules. Possible values are `AzureServices` and `None`.
          * `default_action` (`pulumi.Input[str]`) - The Default Action to use when no rules match from `ip_rules` / `virtual_network_subnet_ids`. Possible values are `Allow` and `Deny`.
          * `ip_rules` (`pulumi.Input[list]`) - One or more IP Addresses, or CIDR Blocks which should be able to access the Key Vault.
          * `virtual_network_subnet_ids` (`pulumi.Input[list]`) - One or more Subnet ID's which should be able to access this Key Vault.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = dict()

        __props__["access_policies"] = access_policies
        __props__["enabled_for_deployment"] = enabled_for_deployment
        __props__["enabled_for_disk_encryption"] = enabled_for_disk_encryption
        __props__["enabled_for_template_deployment"] = enabled_for_template_deployment
        __props__["location"] = location
        __props__["name"] = name
        __props__["network_acls"] = network_acls
        __props__["purge_protection_enabled"] = purge_protection_enabled
        __props__["resource_group_name"] = resource_group_name
        __props__["sku_name"] = sku_name
        __props__["soft_delete_enabled"] = soft_delete_enabled
        __props__["tags"] = tags
        __props__["tenant_id"] = tenant_id
        __props__["vault_uri"] = vault_uri
        return KeyVault(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
