diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py index bb2afb4d5a2a..85844c56f854 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py @@ -911,9 +911,9 @@ class VaultPatchProperties(Model): :type tenant_id: str :param sku: SKU details :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] :param enabled_for_deployment: Property to specify whether Azure Virtual @@ -988,10 +988,10 @@ class VaultProperties(Model): :type tenant_id: str :param sku: Required. SKU details :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] :param vault_uri: The URI of the vault for performing operations on keys diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 7c13a32a59ed..9e436db58a6e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -911,9 +911,9 @@ class VaultPatchProperties(Model): :type tenant_id: str :param sku: SKU details :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] :param enabled_for_deployment: Property to specify whether Azure Virtual @@ -988,10 +988,10 @@ class VaultProperties(Model): :type tenant_id: str :param sku: Required. SKU details :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] :param vault_uri: The URI of the vault for performing operations on keys diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index b01b85c04d61..ffc13a7a59f6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py @@ -17,6 +17,7 @@ from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import Operations +from .operations import KeysOperations from . import models @@ -34,6 +35,8 @@ class KeyVaultManagementClient(SDKClient): :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.operations.Operations + :ivar keys: Keys operations + :vartype keys: azure.mgmt.keyvault.v2019_09_01.operations.KeysOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -64,3 +67,5 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.operations = Operations( self._client, self.config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index 047f744d15bf..58f5e9a7050d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py @@ -11,10 +11,15 @@ try: from ._models_py3 import AccessPolicyEntry + from ._models_py3 import Attributes from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import DeletedVault from ._models_py3 import DeletedVaultProperties from ._models_py3 import IPRule + from ._models_py3 import Key + from ._models_py3 import KeyAttributes + from ._models_py3 import KeyCreateParameters + from ._models_py3 import KeyProperties from ._models_py3 import LogSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation @@ -40,10 +45,15 @@ from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): from ._models import AccessPolicyEntry + from ._models import Attributes from ._models import CheckNameAvailabilityResult from ._models import DeletedVault from ._models import DeletedVaultProperties from ._models import IPRule + from ._models import Key + from ._models import KeyAttributes + from ._models import KeyCreateParameters + from ._models import KeyProperties from ._models import LogSpecification from ._models import NetworkRuleSet from ._models import Operation @@ -68,6 +78,7 @@ from ._models import VaultProperties from ._models import VirtualNetworkRule from ._paged_models import DeletedVaultPaged +from ._paged_models import KeyPaged from ._paged_models import OperationPaged from ._paged_models import ResourcePaged from ._paged_models import VaultPaged @@ -83,15 +94,24 @@ PrivateEndpointServiceConnectionStatus, PrivateEndpointConnectionProvisioningState, Reason, + DeletionRecoveryLevel, + JsonWebKeyType, + JsonWebKeyOperation, + JsonWebKeyCurveName, AccessPolicyUpdateKind, ) __all__ = [ 'AccessPolicyEntry', + 'Attributes', 'CheckNameAvailabilityResult', 'DeletedVault', 'DeletedVaultProperties', 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyProperties', 'LogSpecification', 'NetworkRuleSet', 'Operation', @@ -119,6 +139,7 @@ 'DeletedVaultPaged', 'ResourcePaged', 'OperationPaged', + 'KeyPaged', 'SkuName', 'KeyPermissions', 'SecretPermissions', @@ -130,5 +151,9 @@ 'PrivateEndpointServiceConnectionStatus', 'PrivateEndpointConnectionProvisioningState', 'Reason', + 'DeletionRecoveryLevel', + 'JsonWebKeyType', + 'JsonWebKeyOperation', + 'JsonWebKeyCurveName', 'AccessPolicyUpdateKind', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index f994b6eca629..b6d0989ead2a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -20,6 +20,7 @@ class SkuName(str, Enum): class KeyPermissions(str, Enum): + all = "all" encrypt = "encrypt" decrypt = "decrypt" wrap_key = "wrapKey" @@ -40,6 +41,7 @@ class KeyPermissions(str, Enum): class SecretPermissions(str, Enum): + all = "all" get = "get" list = "list" set = "set" @@ -52,6 +54,7 @@ class SecretPermissions(str, Enum): class CertificatePermissions(str, Enum): + all = "all" get = "get" list = "list" delete = "delete" @@ -72,6 +75,7 @@ class CertificatePermissions(str, Enum): class StoragePermissions(str, Enum): + all = "all" get = "get" list = "list" delete = "delete" @@ -130,6 +134,41 @@ class Reason(str, Enum): already_exists = "AlreadyExists" +class DeletionRecoveryLevel(str, Enum): + + purgeable = "Purgeable" + recoverable_purgeable = "Recoverable+Purgeable" + recoverable = "Recoverable" + recoverable_protected_subscription = "Recoverable+ProtectedSubscription" + + +class JsonWebKeyType(str, Enum): + + ec = "EC" + ec_hsm = "EC-HSM" + rsa = "RSA" + rsa_hsm = "RSA-HSM" + + +class JsonWebKeyOperation(str, Enum): + + encrypt = "encrypt" + decrypt = "decrypt" + sign = "sign" + verify = "verify" + wrap_key = "wrapKey" + unwrap_key = "unwrapKey" + import_enum = "import" + + +class JsonWebKeyCurveName(str, Enum): + + p_256 = "P-256" + p_384 = "P-384" + p_521 = "P-521" + p_256_k = "P-256K" + + class AccessPolicyUpdateKind(str, Enum): add = "add" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py index 32b541cd9bd1..b38fe3e51506 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py @@ -55,6 +55,57 @@ def __init__(self, **kwargs): self.permissions = kwargs.get('permissions', None) +class Attributes(Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for + the object. If it contains 'Purgeable', then the object can be permanently + deleted by a privileged user; otherwise, only the system can purge the + object at the end of the retention interval. Possible values include: + 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + 'Recoverable+ProtectedSubscription' + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Attributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.not_before = kwargs.get('not_before', None) + self.expires = kwargs.get('expires', None) + self.created = None + self.updated = None + self.recovery_level = None + + class CheckNameAvailabilityResult(Model): """The CheckNameAvailability operation response. @@ -249,6 +300,252 @@ def __init__(self, **kwargs): self.value = kwargs.get('value', None) +class Resource(Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class Key(Resource): + """The key resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. + Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM' + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 + for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see + JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + 'P-256K' + :type curve_name: str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of + the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'kty': {'min_length': 1}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(Key, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + + +class KeyAttributes(Attributes): + """The attributes of the key. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for + the object. If it contains 'Purgeable', then the object can be permanently + deleted by a privileged user; otherwise, only the system can purge the + object at the end of the retention interval. Possible values include: + 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + 'Recoverable+ProtectedSubscription' + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyAttributes, self).__init__(**kwargs) + + +class KeyCreateParameters(Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: The tags that will be assigned to the key. + :type tags: dict[str, str] + :param properties: Required. The properties of the key to be created. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'KeyProperties'}, + } + + def __init__(self, **kwargs): + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class KeyProperties(Model): + """The properties of the key. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. + Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM' + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 + for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see + JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + 'P-256K' + :type curve_name: str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of + the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'kty': {'min_length': 1}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyProperties, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + + class LogSpecification(Model): """Log specification of operation. @@ -421,49 +718,6 @@ def __init__(self, **kwargs): self.id = None -class Resource(Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - class PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -1004,14 +1258,14 @@ class VaultProperties(Model): :type tenant_id: str :param sku: Required. SKU details :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + and secrets. This property is readonly :type vault_uri: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index 7c0dcb3c6fd4..21dc1e5bcb5d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -55,6 +55,57 @@ def __init__(self, *, tenant_id: str, object_id: str, permissions, application_i self.permissions = permissions +class Attributes(Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for + the object. If it contains 'Purgeable', then the object can be permanently + deleted by a privileged user; otherwise, only the system can purge the + object at the end of the retention interval. Possible values include: + 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + 'Recoverable+ProtectedSubscription' + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__(self, *, enabled: bool=None, not_before: int=None, expires: int=None, **kwargs) -> None: + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + self.recovery_level = None + + class CheckNameAvailabilityResult(Model): """The CheckNameAvailability operation response. @@ -249,6 +300,252 @@ def __init__(self, *, value: str, **kwargs) -> None: self.value = value +class Resource(Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class Key(Resource): + """The key resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. + Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM' + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 + for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see + JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + 'P-256K' + :type curve_name: str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of + the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'kty': {'min_length': 1}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + } + + def __init__(self, *, attributes=None, kty=None, key_ops=None, key_size: int=None, curve_name=None, **kwargs) -> None: + super(Key, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + + +class KeyAttributes(Attributes): + """The attributes of the key. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for + the object. If it contains 'Purgeable', then the object can be permanently + deleted by a privileged user; otherwise, only the system can purge the + object at the end of the retention interval. Possible values include: + 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', + 'Recoverable+ProtectedSubscription' + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__(self, *, enabled: bool=None, not_before: int=None, expires: int=None, **kwargs) -> None: + super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + + +class KeyCreateParameters(Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: The tags that will be assigned to the key. + :type tags: dict[str, str] + :param properties: Required. The properties of the key to be created. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'KeyProperties'}, + } + + def __init__(self, *, properties, tags=None, **kwargs) -> None: + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class KeyProperties(Model): + """The properties of the key. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. + Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM' + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 + for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see + JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', + 'P-256K' + :type curve_name: str or + ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of + the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'kty': {'min_length': 1}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + } + + def __init__(self, *, attributes=None, kty=None, key_ops=None, key_size: int=None, curve_name=None, **kwargs) -> None: + super(KeyProperties, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + + class LogSpecification(Model): """Log specification of operation. @@ -421,49 +718,6 @@ def __init__(self, **kwargs) -> None: self.id = None -class Resource(Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs) -> None: - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - class PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -1004,14 +1258,14 @@ class VaultProperties(Model): :type tenant_id: str :param sku: Required. SKU details :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + and secrets. This property is readonly :type vault_uri: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py index 4eaaf416a4bd..20c5b3d45046 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py @@ -64,3 +64,16 @@ class OperationPaged(Paged): def __init__(self, *args, **kwargs): super(OperationPaged, self).__init__(*args, **kwargs) +class KeyPaged(Paged): + """ + A paging container for iterating over a list of :class:`Key ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Key]'} + } + + def __init__(self, *args, **kwargs): + + super(KeyPaged, self).__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index 70f7bdab83d8..e31db003161f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py @@ -13,10 +13,12 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._keys_operations import KeysOperations __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', + 'KeysOperations', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py new file mode 100644 index 000000000000..8021ae5f68e1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py @@ -0,0 +1,408 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class KeysOperations(object): + """KeysOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-09-01" + + self.config = config + + def create_if_not_exist( + self, resource_group_name, vault_name, key_name, properties, tags=None, custom_headers=None, raw=False, **operation_config): + """Creates the first version of a new key if it does not exist. If it + already exists, then the existing key is returned without any write + operations being performed. This API does not create subsequent + versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which + contains the specified key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to + be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param properties: The properties of the key to be created. + :type properties: + ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties + :param tags: The tags that will be assigned to the key. + :type tags: dict[str, str] + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Key or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.KeyCreateParameters(tags=tags, properties=properties) + + # Construct URL + url = self.create_if_not_exist.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Key', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} + + def get( + self, resource_group_name, vault_name, key_name, custom_headers=None, raw=False, **operation_config): + """Gets the current version of the specified key from the specified key + vault. + + :param resource_group_name: The name of the resource group which + contains the specified key vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be + retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Key or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Key', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} + + def list( + self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which + contains the specified key vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be + retrieved. + :type vault_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Key + :rtype: + ~azure.mgmt.keyvault.v2019_09_01.models.KeyPaged[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.KeyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} + + def get_version( + self, resource_group_name, vault_name, key_name, key_version, custom_headers=None, raw=False, **operation_config): + """Gets the specified version of the specified key in the specified key + vault. + + :param resource_group_name: The name of the resource group which + contains the specified key vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key + version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Key or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_version.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Key', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} + + def list_versions( + self, resource_group_name, vault_name, key_name, custom_headers=None, raw=False, **operation_config): + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which + contains the specified key vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key + versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Key + :rtype: + ~azure.mgmt.keyvault.v2019_09_01.models.KeyPaged[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.KeyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py new file mode 100644 index 000000000000..689af4ca294b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._configuration import KeyVaultManagementClientConfiguration +from ._key_vault_management_client import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration'] + +from .version import VERSION + +__version__ = VERSION + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py new file mode 100644 index 000000000000..71d3bade9787 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +from msrestazure import AzureConfiguration + +from .version import VERSION + + +class KeyVaultManagementClientConfiguration(AzureConfiguration): + """Configuration for KeyVaultManagementClient + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + if credentials is None: + raise ValueError("Parameter 'credentials' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + if not base_url: + base_url = 'https://management.azure.com' + + super(KeyVaultManagementClientConfiguration, self).__init__(base_url) + + # Starting Autorest.Python 4.0.64, make connection pool activated by default + self.keep_alive = True + + self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION)) + self.add_user_agent('Azure-SDK-For-Python') + + self.credentials = credentials + self.subscription_id = subscription_id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py new file mode 100644 index 000000000000..ce4498fc7bbf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py @@ -0,0 +1,70 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.service_client import SDKClient +from msrest import Serializer, Deserializer + +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import VaultsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +from .operations import ManagedHsmsOperations +from . import models + + +class KeyVaultManagementClient(SDKClient): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar config: Configuration for client. + :vartype config: KeyVaultManagementClientConfiguration + + :ivar vaults: Vaults operations + :vartype vaults: azure.mgmt.keyvault.v2020_04_01_preview.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnections operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResources operations + :vartype private_link_resources: azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2020_04_01_preview.operations.Operations + :ivar managed_hsms: ManagedHsms operations + :vartype managed_hsms: azure.mgmt.keyvault.v2020_04_01_preview.operations.ManagedHsmsOperations + + :param credentials: Credentials needed for the client to connect to Azure. + :type credentials: :mod:`A msrestazure Credentials + object` + :param subscription_id: Subscription credentials which uniquely identify + Microsoft Azure subscription. The subscription ID forms part of the URI + for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, credentials, subscription_id, base_url=None): + + self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url) + super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self.config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self.config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self.config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py new file mode 100644 index 000000000000..429c8e8887ed --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AccessPolicyEntry + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultProperties + from ._models_py3 import Error + from ._models_py3 import IPRule + from ._models_py3 import LogSpecification + from ._models_py3 import ManagedHsm + from ._models_py3 import ManagedHsmError, ManagedHsmErrorException + from ._models_py3 import ManagedHsmProperties + from ._models_py3 import ManagedHsmResource + from ._models_py3 import ManagedHsmSku + from ._models_py3 import NetworkRuleSet + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import Permissions + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionItem + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import Resource + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import Vault + from ._models_py3 import VaultAccessPolicyParameters + from ._models_py3 import VaultAccessPolicyProperties + from ._models_py3 import VaultCheckNameAvailabilityParameters + from ._models_py3 import VaultCreateOrUpdateParameters + from ._models_py3 import VaultPatchParameters + from ._models_py3 import VaultPatchProperties + from ._models_py3 import VaultProperties + from ._models_py3 import VirtualNetworkRule +except (SyntaxError, ImportError): + from ._models import AccessPolicyEntry + from ._models import CheckNameAvailabilityResult + from ._models import DeletedVault + from ._models import DeletedVaultProperties + from ._models import Error + from ._models import IPRule + from ._models import LogSpecification + from ._models import ManagedHsm + from ._models import ManagedHsmError, ManagedHsmErrorException + from ._models import ManagedHsmProperties + from ._models import ManagedHsmResource + from ._models import ManagedHsmSku + from ._models import NetworkRuleSet + from ._models import Operation + from ._models import OperationDisplay + from ._models import Permissions + from ._models import PrivateEndpoint + from ._models import PrivateEndpointConnection + from ._models import PrivateEndpointConnectionItem + from ._models import PrivateLinkResource + from ._models import PrivateLinkResourceListResult + from ._models import PrivateLinkServiceConnectionState + from ._models import Resource + from ._models import ServiceSpecification + from ._models import Sku + from ._models import Vault + from ._models import VaultAccessPolicyParameters + from ._models import VaultAccessPolicyProperties + from ._models import VaultCheckNameAvailabilityParameters + from ._models import VaultCreateOrUpdateParameters + from ._models import VaultPatchParameters + from ._models import VaultPatchProperties + from ._models import VaultProperties + from ._models import VirtualNetworkRule +from ._paged_models import DeletedVaultPaged +from ._paged_models import ManagedHsmPaged +from ._paged_models import OperationPaged +from ._paged_models import ResourcePaged +from ._paged_models import VaultPaged +from ._key_vault_management_client_enums import ( + SkuName, + KeyPermissions, + SecretPermissions, + CertificatePermissions, + StoragePermissions, + CreateMode, + NetworkRuleBypassOptions, + NetworkRuleAction, + PrivateEndpointServiceConnectionStatus, + PrivateEndpointConnectionProvisioningState, + Reason, + ManagedHsmSkuName, + ProvisioningState, + AccessPolicyUpdateKind, +) + +__all__ = [ + 'AccessPolicyEntry', + 'CheckNameAvailabilityResult', + 'DeletedVault', + 'DeletedVaultProperties', + 'Error', + 'IPRule', + 'LogSpecification', + 'ManagedHsm', + 'ManagedHsmError', 'ManagedHsmErrorException', + 'ManagedHsmProperties', + 'ManagedHsmResource', + 'ManagedHsmSku', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ServiceSpecification', + 'Sku', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'VaultPaged', + 'DeletedVaultPaged', + 'ResourcePaged', + 'OperationPaged', + 'ManagedHsmPaged', + 'SkuName', + 'KeyPermissions', + 'SecretPermissions', + 'CertificatePermissions', + 'StoragePermissions', + 'CreateMode', + 'NetworkRuleBypassOptions', + 'NetworkRuleAction', + 'PrivateEndpointServiceConnectionStatus', + 'PrivateEndpointConnectionProvisioningState', + 'Reason', + 'ManagedHsmSkuName', + 'ProvisioningState', + 'AccessPolicyUpdateKind', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..1853f1636a8e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py @@ -0,0 +1,159 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + + +class SkuName(str, Enum): + + standard = "standard" + premium = "premium" + + +class KeyPermissions(str, Enum): + + all = "all" + encrypt = "encrypt" + decrypt = "decrypt" + wrap_key = "wrapKey" + unwrap_key = "unwrapKey" + sign = "sign" + verify = "verify" + get = "get" + list = "list" + create = "create" + update = "update" + import_enum = "import" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + + +class SecretPermissions(str, Enum): + + all = "all" + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + + +class CertificatePermissions(str, Enum): + + all = "all" + get = "get" + list = "list" + delete = "delete" + create = "create" + import_enum = "import" + update = "update" + managecontacts = "managecontacts" + getissuers = "getissuers" + listissuers = "listissuers" + setissuers = "setissuers" + deleteissuers = "deleteissuers" + manageissuers = "manageissuers" + recover = "recover" + purge = "purge" + backup = "backup" + restore = "restore" + + +class StoragePermissions(str, Enum): + + all = "all" + get = "get" + list = "list" + delete = "delete" + set = "set" + update = "update" + regeneratekey = "regeneratekey" + recover = "recover" + purge = "purge" + backup = "backup" + restore = "restore" + setsas = "setsas" + listsas = "listsas" + getsas = "getsas" + deletesas = "deletesas" + + +class CreateMode(str, Enum): + + recover = "recover" + default = "default" + + +class NetworkRuleBypassOptions(str, Enum): + + azure_services = "AzureServices" + none = "None" + + +class NetworkRuleAction(str, Enum): + + allow = "Allow" + deny = "Deny" + + +class PrivateEndpointServiceConnectionStatus(str, Enum): + + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" + + +class PrivateEndpointConnectionProvisioningState(str, Enum): + + succeeded = "Succeeded" + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + failed = "Failed" + disconnected = "Disconnected" + + +class Reason(str, Enum): + + account_name_invalid = "AccountNameInvalid" + already_exists = "AlreadyExists" + + +class ManagedHsmSkuName(str, Enum): + + standard_b1 = "Standard_B1" + custom_b32 = "Custom_B32" + + +class ProvisioningState(str, Enum): + + succeeded = "Succeeded" #: The managed HSM Pool has been full provisioned. + provisioning = "Provisioning" #: The managed HSM Pool is currently being provisioned. + failed = "Failed" #: Provisioning of the managed HSM Pool has failed. + updating = "Updating" #: The managed HSM Pool is currently being updated. + deleting = "Deleting" #: The managed HSM Pool is currently being deleted. + activated = "Activated" #: The managed HSM pool is ready for normal use. + security_domain_restore = "SecurityDomainRestore" #: The managed HSM pool is waiting for a security domain restore action. + restoring = "Restoring" #: The managed HSM pool is being restored from full HSM backup. + + +class AccessPolicyUpdateKind(str, Enum): + + add = "add" + replace = "replace" + remove = "remove" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py new file mode 100644 index 000000000000..e27e0beafdf6 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py @@ -0,0 +1,1409 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AccessPolicyEntry(Model): + """An identity that have access to the key vault. All identities in the array + must use the same tenant ID as the key vault's tenant ID. + + All required parameters must be populated in order to send to Azure. + + :param tenant_id: Required. The Azure Active Directory tenant ID that + should be used for authenticating requests to the key vault. + :type tenant_id: str + :param object_id: Required. 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. + :type object_id: str + :param application_id: Application ID of the client making request on + behalf of a principal + :type application_id: str + :param permissions: Required. Permissions the identity has for keys, + secrets and certificates. + :type permissions: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__(self, **kwargs): + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.object_id = kwargs.get('object_id', None) + self.application_id = kwargs.get('application_id', None) + self.permissions = kwargs.get('permissions', None) + + +class CheckNameAvailabilityResult(Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: A boolean value that indicates whether the name is + available for you to use. If true, the name is available. If false, the + name has already been taken or is invalid and cannot be used. + :vartype name_available: bool + :ivar reason: The reason that a vault name could not be used. The Reason + element is only returned if NameAvailable is false. Possible values + include: 'AccountNameInvalid', 'AlreadyExists' + :vartype reason: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Reason + :ivar message: An error message explaining the Reason value in more + detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'Reason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudError(Model): + """An error response from Key Vault resource provider. + + :param error: + :type error: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from Key Vault resource provider. + + :param code: Error code. This is a mnemonic that can be consumed + programmatically. + :type code: str + :param message: User friendly error message. The message is typically + localized and may vary with service version. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class DeletedVault(Model): + """Deleted vault information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource ID for the deleted key vault. + :vartype id: str + :ivar name: The name of the key vault. + :vartype name: str + :ivar type: The resource type of the key vault. + :vartype type: str + :param properties: Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, + } + + def __init__(self, **kwargs): + super(DeletedVault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class DeletedVaultProperties(Model): + """Properties of the deleted vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar vault_id: The resource id of the original vault. + :vartype vault_id: str + :ivar location: The location of the original vault. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: datetime + :ivar tags: Tags of the original vault. + :vartype tags: dict[str, str] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'vault_id': {'key': 'vaultId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(DeletedVaultProperties, self).__init__(**kwargs) + self.vault_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.tags = None + + +class Error(Model): + """The server error. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The inner error, contains a more specific error code. + :vartype inner_error: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IPRule(Model): + """A rule governing the accessibility of a vault from a specific ip address or + ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as + '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that + start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(IPRule, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class LogSpecification(Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class ManagedHsmResource(Model): + """Managed HSM resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool + should be created. + :type location: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(ManagedHsmResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + + +class ManagedHsm(ManagedHsmResource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool + should be created. + :type location: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :param tags: Resource tags + :type tags: dict[str, str] + :param properties: Properties of the managed HSM + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, + } + + def __init__(self, **kwargs): + super(ManagedHsm, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ManagedHsmError(Model): + """The error exception. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(ManagedHsmError, self).__init__(**kwargs) + self.error = None + + +class ManagedHsmErrorException(HttpOperationError): + """Server responsed with exception of type: 'ManagedHsmError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ManagedHsmErrorException, self).__init__(deserialize, response, 'ManagedHsmError', *args) + + +class ManagedHsmProperties(Model): + """Properties of the managed HSM Pool. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param tenant_id: The Azure Active Directory tenant ID that should be used + for authenticating requests to the managed HSM pool. + :type tenant_id: str + :param initial_admin_object_ids: Array of initial administrators object + ids for this managed hsm pool. + :type initial_admin_object_ids: list[str] + :ivar hsm_uri: The URI of the managed hsm pool for performing operations + on keys. + :vartype hsm_uri: str + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this managed HSM pool. If it's not set to any + value(true or false) when creating new managed HSM pool, it will be set to + true by default. Once set to true, it cannot be reverted to false. Default + value: True . + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. Default value: 90 . + :type soft_delete_retention_in_days: int + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this managed HSM pool. Setting this property + to true activates protection against purge for this managed HSM pool and + its content - only the Managed HSM service may initiate a hard, + irrecoverable deletion. The setting is effective only if soft delete is + also enabled. Enabling this functionality is irreversible. Default value: + True . + :type enable_purge_protection: bool + :param create_mode: The create mode to indicate whether the resource is + being created or is being recovered from a deleted resource. Possible + values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :ivar status_message: Resource Status Message. + :vartype status_message: str + :ivar provisioning_state: Provisioning state. Possible values include: + 'Succeeded', 'Provisioning', 'Failed', 'Updating', 'Deleting', + 'Activated', 'SecurityDomainRestore', 'Restoring' + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ProvisioningState + """ + + _validation = { + 'hsm_uri': {'readonly': True}, + 'status_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, + 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedHsmProperties, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) + self.hsm_uri = None + self.enable_soft_delete = kwargs.get('enable_soft_delete', True) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) + self.enable_purge_protection = kwargs.get('enable_purge_protection', True) + self.create_mode = kwargs.get('create_mode', None) + self.status_message = None + self.provisioning_state = None + + +class ManagedHsmSku(Model): + """SKU details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU Family of the managed HSM Pool. Default value: + "B" . + :vartype family: str + :param name: Required. SKU of the managed HSM Pool. Possible values + include: 'Standard_B1', 'Custom_B32' + :type name: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ManagedHsmSkuName'}, + } + + family = "B" + + def __init__(self, **kwargs): + super(ManagedHsmSku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class NetworkRuleSet(Model): + """A set of rules governing the network accessibility of a vault. + + :param bypass: Tells what traffic can bypass network rules. This can be + 'AzureServices' or 'None'. If not specified the default is + 'AzureServices'. Possible values include: 'AzureServices', 'None' + :type bypass: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and + from virtualNetworkRules match. This is only used after the bypass + property has been evaluated. Possible values include: 'Allow', 'Deny' + :type default_action: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.VirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + } + + def __init__(self, **kwargs): + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = kwargs.get('bypass', None) + self.default_action = kwargs.get('default_action', None) + self.ip_rules = kwargs.get('ip_rules', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + + +class Operation(Model): + """Key Vault REST API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: Display metadata associated with the operation. + :type display: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric + specifications. + :type service_specification: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, **kwargs): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft Key Vault. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class Permissions(Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :param keys: Permissions to keys + :type keys: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets + :type secrets: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates + :type certificates: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts + :type storage: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + 'secrets': {'key': 'secrets', 'type': '[str]'}, + 'certificates': {'key': 'certificates', 'type': '[str]'}, + 'storage': {'key': 'storage', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(Permissions, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + self.secrets = kwargs.get('secrets', None) + self.certificates = kwargs.get('certificates', None) + self.storage = kwargs.get('storage', None) + + +class PrivateEndpoint(Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class Resource(Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class PrivateEndpointConnection(Resource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the + private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Updating', + 'Deleting', 'Failed', 'Disconnected' + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionItem(Model): + """Private endpoint connection item. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the + private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Updating', + 'Deleting', 'Failed', 'Disconnected' + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private + link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(Model): + """A list of private link resources. + + :param value: Array of private link resources + :type value: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(Model): + """An object that represents the approval state of the private link + connection. + + :param status: Indicates whether the connection has been approved, + rejected or removed by the key vault owner. Possible values include: + 'Pending', 'Approved', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param action_required: A message indicating if changes on the service + provider require any updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.action_required = kwargs.get('action_required', None) + + +class ServiceSpecification(Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__(self, **kwargs): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + + +class Sku(Model): + """SKU details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU family name. Default value: "A" . + :vartype family: str + :param name: Required. SKU name to specify whether the key vault is a + standard vault or a premium vault. Possible values include: 'standard', + 'premium' + :type name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'SkuName'}, + } + + family = "A" + + def __init__(self, **kwargs): + super(Sku, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class Vault(Model): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :param location: Azure location of the key vault resource. + :type location: str + :param tags: Tags assigned to the key vault resource. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__(self, **kwargs): + super(Vault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class VaultAccessPolicyParameters(Model): + """Parameters for updating the access policy in a vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource id of the access policy. + :vartype id: str + :ivar name: The resource name of the access policy. + :vartype name: str + :ivar type: The resource name of the access policy. + :vartype type: str + :ivar location: The resource type of the access policy. + :vartype location: str + :param properties: Required. Properties of the access policy + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, + } + + def __init__(self, **kwargs): + super(VaultAccessPolicyParameters, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = kwargs.get('properties', None) + + +class VaultAccessPolicyProperties(Model): + """Properties of the vault access policy. + + All required parameters must be populated in order to send to Azure. + + :param access_policies: Required. An array of 0 to 16 identities that have + access to the key vault. All identities in the array must use the same + tenant ID as the key vault's tenant ID. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + """ + + _validation = { + 'access_policies': {'required': True}, + } + + _attribute_map = { + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + } + + def __init__(self, **kwargs): + super(VaultAccessPolicyProperties, self).__init__(**kwargs) + self.access_policies = kwargs.get('access_policies', None) + + +class VaultCheckNameAvailabilityParameters(Model): + """The parameters used to check the availability of the vault name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The vault name. + :type name: str + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. + Default value: "Microsoft.KeyVault/vaults" . + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.KeyVault/vaults" + + def __init__(self, **kwargs): + super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + + +class VaultCreateOrUpdateParameters(Model): + """Parameters for creating or updating a vault. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the key + vault should be created. + :type location: str + :param tags: The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__(self, **kwargs): + super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class VaultPatchParameters(Model): + """Parameters for creating or updating a vault. + + :param tags: The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, + } + + def __init__(self, **kwargs): + super(VaultPatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class VaultPatchProperties(Model): + """Properties of the vault. + + :param tenant_id: The Azure Active Directory tenant ID that should be used + for authenticating requests to the key vault. + :type tenant_id: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :param access_policies: An array of 0 to 16 identities that have access to + the key vault. All identities in the array must use the same tenant ID as + the key vault's tenant ID. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual + Machines are permitted to retrieve certificates stored as secrets from the + key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk + Encryption is permitted to retrieve secrets from the vault and unwrap + keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure + Resource Manager is permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this key vault. Once set to true, it cannot + be reverted to false. + :type enable_soft_delete: bool + :param enable_rbac_authorization: Property that controls how data actions + are authorized. When true, the key vault will use Role Based Access + Control (RBAC) for authorization of data actions, and the access policies + specified in vault properties will be ignored (warning: this is a preview + feature). When false, the key vault will use the access policies specified + in vault properties, and any policy stored on Azure Resource Manager will + be ignored. If null or not specified, the value of this property will not + change. + :type enable_rbac_authorization: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param create_mode: The vault's create mode to indicate whether the vault + need to be recovered or not. Possible values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this vault. Setting this property to true + activates protection against purge for this vault and its content - only + the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept + false as its value. + :type enable_purge_protection: bool + :param network_acls: A collection of rules governing the accessibility of + the vault from specific network locations. + :type network_acls: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + } + + def __init__(self, **kwargs): + super(VaultPatchProperties, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.sku = kwargs.get('sku', None) + self.access_policies = kwargs.get('access_policies', None) + self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) + self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) + self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) + self.enable_soft_delete = kwargs.get('enable_soft_delete', None) + self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', None) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.network_acls = kwargs.get('network_acls', None) + + +class VaultProperties(Model): + """Properties of the vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tenant_id: Required. The Azure Active Directory tenant ID that + should be used for authenticating requests to the key vault. + :type tenant_id: str + :param sku: Required. SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys + and secrets. This property is readonly + :type vault_uri: str + :param enabled_for_deployment: Property to specify whether Azure Virtual + Machines are permitted to retrieve certificates stored as secrets from the + key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk + Encryption is permitted to retrieve secrets from the vault and unwrap + keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure + Resource Manager is permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this key vault. If it's not set to any + value(true or false) when creating new key vault, it will be set to true + by default. Once set to true, it cannot be reverted to false. Default + value: True . + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. Default value: 90 . + :type soft_delete_retention_in_days: int + :param enable_rbac_authorization: Property that controls how data actions + are authorized. When true, the key vault will use Role Based Access + Control (RBAC) for authorization of data actions, and the access policies + specified in vault properties will be ignored (warning: this is a preview + feature). When false, the key vault will use the access policies specified + in vault properties, and any policy stored on Azure Resource Manager will + be ignored. If null or not specified, the vault is created with the + default value of false. Note that management actions are always authorized + with RBAC. Default value: False . + :type enable_rbac_authorization: bool + :param create_mode: The vault's create mode to indicate whether the vault + need to be recovered or not. Possible values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this vault. Setting this property to true + activates protection against purge for this vault and its content - only + the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept + false as its value. + :type enable_purge_protection: bool + :param network_acls: Rules governing the accessibility of the key vault + from specific network locations. + :type network_acls: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections + associated with the key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionItem] + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, + } + + def __init__(self, **kwargs): + super(VaultProperties, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.sku = kwargs.get('sku', None) + self.access_policies = kwargs.get('access_policies', None) + self.vault_uri = kwargs.get('vault_uri', None) + self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) + self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) + self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) + self.enable_soft_delete = kwargs.get('enable_soft_delete', True) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) + self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.network_acls = kwargs.get('network_acls', None) + self.private_endpoint_connections = None + + +class VirtualNetworkRule(Model): + """A rule governing the accessibility of a vault from a specific virtual + network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs.get('id', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..08a023ae624a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py @@ -0,0 +1,1409 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.serialization import Model +from msrest.exceptions import HttpOperationError + + +class AccessPolicyEntry(Model): + """An identity that have access to the key vault. All identities in the array + must use the same tenant ID as the key vault's tenant ID. + + All required parameters must be populated in order to send to Azure. + + :param tenant_id: Required. The Azure Active Directory tenant ID that + should be used for authenticating requests to the key vault. + :type tenant_id: str + :param object_id: Required. 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. + :type object_id: str + :param application_id: Application ID of the client making request on + behalf of a principal + :type application_id: str + :param permissions: Required. Permissions the identity has for keys, + secrets and certificates. + :type permissions: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None: + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.object_id = object_id + self.application_id = application_id + self.permissions = permissions + + +class CheckNameAvailabilityResult(Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name_available: A boolean value that indicates whether the name is + available for you to use. If true, the name is available. If false, the + name has already been taken or is invalid and cannot be used. + :vartype name_available: bool + :ivar reason: The reason that a vault name could not be used. The Reason + element is only returned if NameAvailable is false. Possible values + include: 'AccountNameInvalid', 'AlreadyExists' + :vartype reason: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Reason + :ivar message: An error message explaining the Reason value in more + detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'Reason'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudError(Model): + """An error response from Key Vault resource provider. + + :param error: + :type error: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CloudErrorBody + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CloudErrorBody'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CloudErrorBody(Model): + """An error response from Key Vault resource provider. + + :param code: Error code. This is a mnemonic that can be consumed + programmatically. + :type code: str + :param message: User friendly error message. The message is typically + localized and may vary with service version. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + + +class DeletedVault(Model): + """Deleted vault information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The resource ID for the deleted key vault. + :vartype id: str + :ivar name: The name of the key vault. + :vartype name: str + :ivar type: The resource type of the key vault. + :vartype type: str + :param properties: Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, + } + + def __init__(self, *, properties=None, **kwargs) -> None: + super(DeletedVault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DeletedVaultProperties(Model): + """Properties of the deleted vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar vault_id: The resource id of the original vault. + :vartype vault_id: str + :ivar location: The location of the original vault. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: datetime + :ivar tags: Tags of the original vault. + :vartype tags: dict[str, str] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'vault_id': {'key': 'vaultId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedVaultProperties, self).__init__(**kwargs) + self.vault_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.tags = None + + +class Error(Model): + """The server error. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The inner error, contains a more specific error code. + :vartype inner_error: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__(self, **kwargs) -> None: + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IPRule(Model): + """A rule governing the accessibility of a vault from a specific ip address or + ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as + '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that + start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, value: str, **kwargs) -> None: + super(IPRule, self).__init__(**kwargs) + self.value = value + + +class LogSpecification(Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedHsmResource(Model): + """Managed HSM resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool + should be created. + :type location: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :param tags: Resource tags + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, location: str=None, sku=None, tags=None, **kwargs) -> None: + super(ManagedHsmResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.sku = sku + self.tags = tags + + +class ManagedHsm(ManagedHsmResource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool + should be created. + :type location: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :param tags: Resource tags + :type tags: dict[str, str] + :param properties: Properties of the managed HSM + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, + } + + def __init__(self, *, location: str=None, sku=None, tags=None, properties=None, **kwargs) -> None: + super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.properties = properties + + +class ManagedHsmError(Model): + """The error exception. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, **kwargs) -> None: + super(ManagedHsmError, self).__init__(**kwargs) + self.error = None + + +class ManagedHsmErrorException(HttpOperationError): + """Server responsed with exception of type: 'ManagedHsmError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(ManagedHsmErrorException, self).__init__(deserialize, response, 'ManagedHsmError', *args) + + +class ManagedHsmProperties(Model): + """Properties of the managed HSM Pool. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param tenant_id: The Azure Active Directory tenant ID that should be used + for authenticating requests to the managed HSM pool. + :type tenant_id: str + :param initial_admin_object_ids: Array of initial administrators object + ids for this managed hsm pool. + :type initial_admin_object_ids: list[str] + :ivar hsm_uri: The URI of the managed hsm pool for performing operations + on keys. + :vartype hsm_uri: str + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this managed HSM pool. If it's not set to any + value(true or false) when creating new managed HSM pool, it will be set to + true by default. Once set to true, it cannot be reverted to false. Default + value: True . + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. Default value: 90 . + :type soft_delete_retention_in_days: int + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this managed HSM pool. Setting this property + to true activates protection against purge for this managed HSM pool and + its content - only the Managed HSM service may initiate a hard, + irrecoverable deletion. The setting is effective only if soft delete is + also enabled. Enabling this functionality is irreversible. Default value: + True . + :type enable_purge_protection: bool + :param create_mode: The create mode to indicate whether the resource is + being created or is being recovered from a deleted resource. Possible + values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :ivar status_message: Resource Status Message. + :vartype status_message: str + :ivar provisioning_state: Provisioning state. Possible values include: + 'Succeeded', 'Provisioning', 'Failed', 'Updating', 'Deleting', + 'Activated', 'SecurityDomainRestore', 'Restoring' + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ProvisioningState + """ + + _validation = { + 'hsm_uri': {'readonly': True}, + 'status_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, + 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__(self, *, tenant_id: str=None, initial_admin_object_ids=None, enable_soft_delete: bool=True, soft_delete_retention_in_days: int=90, enable_purge_protection: bool=True, create_mode=None, **kwargs) -> None: + super(ManagedHsmProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.initial_admin_object_ids = initial_admin_object_ids + self.hsm_uri = None + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_purge_protection = enable_purge_protection + self.create_mode = create_mode + self.status_message = None + self.provisioning_state = None + + +class ManagedHsmSku(Model): + """SKU details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU Family of the managed HSM Pool. Default value: + "B" . + :vartype family: str + :param name: Required. SKU of the managed HSM Pool. Possible values + include: 'Standard_B1', 'Custom_B32' + :type name: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'ManagedHsmSkuName'}, + } + + family = "B" + + def __init__(self, *, name, **kwargs) -> None: + super(ManagedHsmSku, self).__init__(**kwargs) + self.name = name + + +class NetworkRuleSet(Model): + """A set of rules governing the network accessibility of a vault. + + :param bypass: Tells what traffic can bypass network rules. This can be + 'AzureServices' or 'None'. If not specified the default is + 'AzureServices'. Possible values include: 'AzureServices', 'None' + :type bypass: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and + from virtualNetworkRules match. This is only used after the bypass + property has been evaluated. Possible values include: 'Allow', 'Deny' + :type default_action: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.VirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + } + + def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_network_rules=None, **kwargs) -> None: + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.default_action = default_action + self.ip_rules = ip_rules + self.virtual_network_rules = virtual_network_rules + + +class Operation(Model): + """Key Vault REST API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation} + :type name: str + :param display: Display metadata associated with the operation. + :type display: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric + specifications. + :type service_specification: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__(self, *, name: str=None, display=None, origin: str=None, service_specification=None, **kwargs) -> None: + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.service_specification = service_specification + + +class OperationDisplay(Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft Key Vault. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class Permissions(Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :param keys: Permissions to keys + :type keys: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets + :type secrets: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates + :type certificates: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts + :type storage: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + 'secrets': {'key': 'secrets', 'type': '[str]'}, + 'certificates': {'key': 'certificates', 'type': '[str]'}, + 'storage': {'key': 'storage', 'type': '[str]'}, + } + + def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, **kwargs) -> None: + super(Permissions, self).__init__(**kwargs) + self.keys = keys + self.secrets = secrets + self.certificates = certificates + self.storage = storage + + +class PrivateEndpoint(Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class Resource(Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs) -> None: + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class PrivateEndpointConnection(Resource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the + private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Updating', + 'Deleting', 'Failed', 'Disconnected' + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionItem(Model): + """Private endpoint connection item. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the + private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Updating', + 'Deleting', 'Failed', 'Disconnected' + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private + link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__(self, *, required_zone_names=None, **kwargs) -> None: + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(Model): + """A list of private link resources. + + :param value: Array of private link resources + :type value: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(Model): + """An object that represents the approval state of the private link + connection. + + :param status: Indicates whether the connection has been approved, + rejected or removed by the key vault owner. Possible values include: + 'Pending', 'Approved', 'Rejected', 'Disconnected' + :type status: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param action_required: A message indicating if changes on the service + provider require any updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__(self, *, status=None, description: str=None, action_required: str=None, **kwargs) -> None: + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.action_required = action_required + + +class ServiceSpecification(Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__(self, *, log_specifications=None, **kwargs) -> None: + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + + +class Sku(Model): + """SKU details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU family name. Default value: "A" . + :vartype family: str + :param name: Required. SKU name to specify whether the key vault is a + standard vault or a premium vault. Possible values include: 'standard', + 'premium' + :type name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'SkuName'}, + } + + family = "A" + + def __init__(self, *, name, **kwargs) -> None: + super(Sku, self).__init__(**kwargs) + self.name = name + + +class Vault(Model): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :param location: Azure location of the key vault resource. + :type location: str + :param tags: Tags assigned to the key vault resource. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__(self, *, properties, location: str=None, tags=None, **kwargs) -> None: + super(Vault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.properties = properties + + +class VaultAccessPolicyParameters(Model): + """Parameters for updating the access policy in a vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource id of the access policy. + :vartype id: str + :ivar name: The resource name of the access policy. + :vartype name: str + :ivar type: The resource name of the access policy. + :vartype type: str + :ivar location: The resource type of the access policy. + :vartype location: str + :param properties: Required. Properties of the access policy + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, + } + + def __init__(self, *, properties, **kwargs) -> None: + super(VaultAccessPolicyParameters, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class VaultAccessPolicyProperties(Model): + """Properties of the vault access policy. + + All required parameters must be populated in order to send to Azure. + + :param access_policies: Required. An array of 0 to 16 identities that have + access to the key vault. All identities in the array must use the same + tenant ID as the key vault's tenant ID. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + """ + + _validation = { + 'access_policies': {'required': True}, + } + + _attribute_map = { + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + } + + def __init__(self, *, access_policies, **kwargs) -> None: + super(VaultAccessPolicyProperties, self).__init__(**kwargs) + self.access_policies = access_policies + + +class VaultCheckNameAvailabilityParameters(Model): + """The parameters used to check the availability of the vault name. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The vault name. + :type name: str + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. + Default value: "Microsoft.KeyVault/vaults" . + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.KeyVault/vaults" + + def __init__(self, *, name: str, **kwargs) -> None: + super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class VaultCreateOrUpdateParameters(Model): + """Parameters for creating or updating a vault. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the key + vault should be created. + :type location: str + :param tags: The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.properties = properties + + +class VaultPatchParameters(Model): + """Parameters for creating or updating a vault. + + :param tags: The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, + } + + def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + super(VaultPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class VaultPatchProperties(Model): + """Properties of the vault. + + :param tenant_id: The Azure Active Directory tenant ID that should be used + for authenticating requests to the key vault. + :type tenant_id: str + :param sku: SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :param access_policies: An array of 0 to 16 identities that have access to + the key vault. All identities in the array must use the same tenant ID as + the key vault's tenant ID. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual + Machines are permitted to retrieve certificates stored as secrets from the + key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk + Encryption is permitted to retrieve secrets from the vault and unwrap + keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure + Resource Manager is permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this key vault. Once set to true, it cannot + be reverted to false. + :type enable_soft_delete: bool + :param enable_rbac_authorization: Property that controls how data actions + are authorized. When true, the key vault will use Role Based Access + Control (RBAC) for authorization of data actions, and the access policies + specified in vault properties will be ignored (warning: this is a preview + feature). When false, the key vault will use the access policies specified + in vault properties, and any policy stored on Azure Resource Manager will + be ignored. If null or not specified, the value of this property will not + change. + :type enable_rbac_authorization: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param create_mode: The vault's create mode to indicate whether the vault + need to be recovered or not. Possible values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this vault. Setting this property to true + activates protection against purge for this vault and its content - only + the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept + false as its value. + :type enable_purge_protection: bool + :param network_acls: A collection of rules governing the accessibility of + the vault from specific network locations. + :type network_acls: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + } + + def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, enable_rbac_authorization: bool=None, soft_delete_retention_in_days: int=None, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + super(VaultPatchProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.enable_rbac_authorization = enable_rbac_authorization + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + + +class VaultProperties(Model): + """Properties of the vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param tenant_id: Required. The Azure Active Directory tenant ID that + should be used for authenticating requests to the key vault. + :type tenant_id: str + :param sku: Required. SKU details + :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :param access_policies: An array of 0 to 1024 identities that have access + to the key vault. All identities in the array must use the same tenant ID + as the key vault's tenant ID. When `createMode` is set to `recover`, + access policies are not required. Otherwise, access policies are required. + :type access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys + and secrets. This property is readonly + :type vault_uri: str + :param enabled_for_deployment: Property to specify whether Azure Virtual + Machines are permitted to retrieve certificates stored as secrets from the + key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk + Encryption is permitted to retrieve secrets from the vault and unwrap + keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure + Resource Manager is permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' + functionality is enabled for this key vault. If it's not set to any + value(true or false) when creating new key vault, it will be set to true + by default. Once set to true, it cannot be reverted to false. Default + value: True . + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It + accepts >=7 and <=90. Default value: 90 . + :type soft_delete_retention_in_days: int + :param enable_rbac_authorization: Property that controls how data actions + are authorized. When true, the key vault will use Role Based Access + Control (RBAC) for authorization of data actions, and the access policies + specified in vault properties will be ignored (warning: this is a preview + feature). When false, the key vault will use the access policies specified + in vault properties, and any policy stored on Azure Resource Manager will + be ignored. If null or not specified, the vault is created with the + default value of false. Note that management actions are always authorized + with RBAC. Default value: False . + :type enable_rbac_authorization: bool + :param create_mode: The vault's create mode to indicate whether the vault + need to be recovered or not. Possible values include: 'recover', 'default' + :type create_mode: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection + against purge is enabled for this vault. Setting this property to true + activates protection against purge for this vault and its content - only + the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept + false as its value. + :type enable_purge_protection: bool + :param network_acls: Rules governing the accessibility of the key vault + from specific network locations. + :type network_acls: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections + associated with the key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionItem] + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, + } + + def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=True, soft_delete_retention_in_days: int=90, enable_rbac_authorization: bool=False, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + super(VaultProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.vault_uri = vault_uri + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_rbac_authorization = enable_rbac_authorization + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + self.private_endpoint_connections = None + + +class VirtualNetworkRule(Model): + """A rule governing the accessibility of a vault from a specific virtual + network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__(self, *, id: str, **kwargs) -> None: + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_paged_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_paged_models.py new file mode 100644 index 000000000000..16d7aed46bf3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_paged_models.py @@ -0,0 +1,79 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from msrest.paging import Paged + + +class VaultPaged(Paged): + """ + A paging container for iterating over a list of :class:`Vault ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Vault]'} + } + + def __init__(self, *args, **kwargs): + + super(VaultPaged, self).__init__(*args, **kwargs) +class DeletedVaultPaged(Paged): + """ + A paging container for iterating over a list of :class:`DeletedVault ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[DeletedVault]'} + } + + def __init__(self, *args, **kwargs): + + super(DeletedVaultPaged, self).__init__(*args, **kwargs) +class ResourcePaged(Paged): + """ + A paging container for iterating over a list of :class:`Resource ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Resource]'} + } + + def __init__(self, *args, **kwargs): + + super(ResourcePaged, self).__init__(*args, **kwargs) +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} + } + + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) +class ManagedHsmPaged(Paged): + """ + A paging container for iterating over a list of :class:`ManagedHsm ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ManagedHsm]'} + } + + def __init__(self, *args, **kwargs): + + super(ManagedHsmPaged, self).__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py new file mode 100644 index 000000000000..107700eb8512 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py @@ -0,0 +1,24 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations +from ._managed_hsms_operations import ManagedHsmsOperations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', + 'ManagedHsmsOperations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py new file mode 100644 index 000000000000..79ccef87b736 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py @@ -0,0 +1,532 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class ManagedHsmsOperations(object): + """ManagedHsmsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2020-04-01-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-04-01-preview" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedHsm') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', response) + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains + the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool + :type parameters: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ManagedHsm or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm]] + :raises: + :class:`ManagedHsmErrorException` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedHsm', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} + + + def _update_initial( + self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'ManagedHsm') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', response) + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, resource_group_name, name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains + the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool + :type name: str + :param parameters: Parameters to patch the managed HSM Pool + :type parameters: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns ManagedHsm or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm]] + :raises: + :class:`ManagedHsmErrorException` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('ManagedHsm', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} + + + def _delete_initial( + self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def delete( + self, resource_group_name, name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains + the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool to delete + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ManagedHsmErrorException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} + + def get( + self, resource_group_name, name, custom_headers=None, raw=False, **operation_config): + """Gets the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains + the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: ManagedHsm or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ManagedHsmErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} + + def list_by_resource_group( + self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): + """The List operation gets information about the managed HSM Pools + associated with the subscription and within the specified resource + group. + + :param resource_group_name: Name of the resource group that contains + the managed HSM pool. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedHsm + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: + :class:`ManagedHsmErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedHsmPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} + + def list_by_subscription( + self, top=None, custom_headers=None, raw=False, **operation_config): + """The List operation gets information about the managed HSM Pools + associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of ManagedHsm + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: + :class:`ManagedHsmErrorException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ManagedHsmErrorException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ManagedHsmPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py new file mode 100644 index 000000000000..613de705d052 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py @@ -0,0 +1,102 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class Operations(object): + """Operations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-09-01" + + self.config = config + + def list( + self, custom_headers=None, raw=False, **operation_config): + """Lists all of the available Key Vault Rest API operations. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.Operation] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..08c94f3035f0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,303 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-09-01" + + self.config = config + + def get( + self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """Gets the specified private endpoint connection associated with the key + vault. + + :param resource_group_name: Name of the resource group that contains + the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint + connection associated with the key vault. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def put( + self, resource_group_name, vault_name, private_endpoint_connection_name, properties, custom_headers=None, raw=False, **operation_config): + """Updates the specified private endpoint connection associated with the + key vault. + + :param resource_group_name: Name of the resource group that contains + the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint + connection associated with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + header_dict = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + header_dict = { + 'Retry-After': 'int', + 'Azure-AsyncOperation': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + + def _delete_initial( + self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + header_dict = {} + + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + header_dict = { + 'Retry-After': 'int', + 'Location': 'str', + } + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + def delete( + self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Deletes the specified private endpoint connection associated with the + key vault. + + :param resource_group_name: Name of the resource group that contains + the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint + connection associated with the key vault. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + PrivateEndpointConnection or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection]] + :raises: :class:`CloudError` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + header_dict = { + 'Retry-After': 'int', + 'Location': 'str', + } + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response.add_headers(header_dict) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..9ab09c349e43 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client Api Version. Constant value: "2019-09-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-09-01" + + self.config = config + + def list_by_vault( + self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + """Gets the private link resources supported for the key vault. + + :param resource_group_name: Name of the resource group that contains + the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateLinkResourceListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_by_vault.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateLinkResourceListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py new file mode 100644 index 000000000000..3e8f555a72e8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py @@ -0,0 +1,929 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class VaultsOperations(object): + """VaultsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar filter: The filter to apply on the operation. Constant value: "resourceType eq 'Microsoft.KeyVault/vaults'". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + + self.config = config + + + def _create_or_update_initial( + self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, **operation_config): + api_version = "2019-09-01" + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Vault', response) + if response.status_code == 201: + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def create_or_update( + self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + """Create or update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which + the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault + :type vault_name: str + :param parameters: Parameters to create or update the vault + :type parameters: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCreateOrUpdateParameters + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Vault or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def update( + self, resource_group_name, vault_name, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which + the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault + :type vault_name: str + :param tags: The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Properties of the vault + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Vault or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.VaultPatchParameters(tags=tags, properties=properties) + + api_version = "2019-09-01" + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', response) + if response.status_code == 201: + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def delete( + self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which + the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete + :type vault_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def get( + self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which + the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Vault or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def update_access_policy( + self, resource_group_name, vault_name, operation_kind, properties, custom_headers=None, raw=False, **operation_config): + """Update access policies in a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which + the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault + :type vault_name: str + :param operation_kind: Name of the operation. Possible values include: + 'add', 'replace', 'remove' + :type operation_kind: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy + :type properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: VaultAccessPolicyParameters or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + parameters = models.VaultAccessPolicyParameters(properties=properties) + + api_version = "2019-09-01" + + # Construct URL + url = self.update_access_policy.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'AccessPolicyUpdateKind'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', response) + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + + def list_by_resource_group( + self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): + """The List operation gets information about the vaults associated with + the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which + the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Vault + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + + def list_by_subscription( + self, top=None, custom_headers=None, raw=False, **operation_config): + """The List operation gets information about the vaults associated with + the subscription. + + :param top: Maximum number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Vault + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + + def list_deleted( + self, custom_headers=None, raw=False, **operation_config): + """Gets information about the deleted vaults in a subscription. + + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of DeletedVault + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault] + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.DeletedVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + + def get_deleted( + self, vault_name, location, custom_headers=None, raw=False, **operation_config): + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: DeletedVault or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + api_version = "2019-09-01" + + # Construct URL + url = self.get_deleted.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('DeletedVault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + + + def _purge_deleted_initial( + self, vault_name, location, custom_headers=None, raw=False, **operation_config): + api_version = "2019-09-01" + + # Construct URL + url = self.purge_deleted.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def purge_deleted( + self, vault_name, location, custom_headers=None, raw=False, polling=True, **operation_config): + """Permanently deletes the specified vault. aka Purges the deleted Azure + key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: :class:`CloudError` + """ + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + def list( + self, top=None, custom_headers=None, raw=False, **operation_config): + """The List operation gets information about the vaults associated with + the subscription. + + :param top: Maximum number of results to return. + :type top: int + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of Resource + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourcePaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.Resource] + :raises: :class:`CloudError` + """ + api_version = "2015-11-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['$filter'] = self._serialize.query("self.filter", self.filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + + def check_name_availability( + self, name, custom_headers=None, raw=False, **operation_config): + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + + api_version = "2019-09-01" + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('CheckNameAvailabilityResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/version.py new file mode 100644 index 000000000000..53a203f32aaf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/version.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +VERSION = "" +