From bc84e1169c04dc6b0b5feec8c31b9c7a721b9e86 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 29 Jan 2021 07:38:19 +0000 Subject: [PATCH] CodeGen from PR 12477 in Azure/azure-rest-api-specs Add missing default error responses (#12477) --- .../keyvault/_key_vault_management_client.py | 13 + .../aio/_key_vault_management_client.py | 13 + .../mgmt/keyvault/v2016_10_01/_metadata.json | 15 +- .../v2016_10_01/aio/operations/_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 62 +-- .../keyvault/v2016_10_01/models/_models.py | 2 +- .../v2016_10_01/models/_models_py3.py | 2 +- .../v2016_10_01/operations/_operations.py | 8 +- .../operations/_vaults_operations.py | 62 +-- .../mgmt/keyvault/v2018_02_14/_metadata.json | 15 +- .../v2018_02_14/aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 31 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 76 ++-- .../keyvault/v2018_02_14/models/_models.py | 2 +- .../v2018_02_14/models/_models_py3.py | 2 +- .../v2018_02_14/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 31 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 76 ++-- .../_key_vault_management_client.py | 5 + .../mgmt/keyvault/v2019_09_01/_metadata.json | 18 +- .../aio/_key_vault_management_client.py | 5 + .../v2019_09_01/aio/operations/__init__.py | 2 + .../aio/operations/_keys_operations.py | 399 ++++++++++++++++ .../v2019_09_01/aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 39 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 80 ++-- .../keyvault/v2019_09_01/models/__init__.py | 28 ++ .../_key_vault_management_client_enums.py | 53 +++ .../keyvault/v2019_09_01/models/_models.py | 393 +++++++++++++--- .../v2019_09_01/models/_models_py3.py | 424 +++++++++++++++--- .../v2019_09_01/operations/__init__.py | 2 + .../operations/_keys_operations.py | 408 +++++++++++++++++ .../v2019_09_01/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 39 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 80 ++-- .../v2020_04_01_preview/_metadata.json | 15 +- .../operations/_managed_hsms_operations.py | 84 ++-- .../aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 39 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 80 ++-- .../v2020_04_01_preview/models/__init__.py | 2 + .../_key_vault_management_client_enums.py | 11 + .../v2020_04_01_preview/models/_models.py | 43 +- .../v2020_04_01_preview/models/_models_py3.py | 49 +- .../operations/_managed_hsms_operations.py | 84 ++-- .../operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 39 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 80 ++-- 54 files changed, 2403 insertions(+), 612 deletions(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py index de68ba06247d..07dcdec5649d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py @@ -100,6 +100,19 @@ def models(cls, api_version=DEFAULT_API_VERSION): return models raise ValueError("API version {} is not available".format(api_version)) + @property + def keys(self): + """Instance depends on the API version: + + * 2019-09-01: :class:`KeysOperations` + """ + api_version = self._get_api_version('keys') + if api_version == '2019-09-01': + from .v2019_09_01.operations import KeysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def managed_hsms(self): """Instance depends on the API version: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py index a967aa9463c8..8373723c2709 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py @@ -100,6 +100,19 @@ def models(cls, api_version=DEFAULT_API_VERSION): return models raise ValueError("API version {} is not available".format(api_version)) + @property + def keys(self): + """Instance depends on the API version: + + * 2019-09-01: :class:`KeysOperations` + """ + api_version = self._get_api_version('keys') + if api_version == '2019-09-01': + from ..v2019_09_01.aio.operations import KeysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def managed_hsms(self): """Instance depends on the API version: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json index 2e4ec38bfc58..08d8133877c7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py index a542c354f3c3..9b3dbffd14a8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index 735e97e7cd61..b6312b6ef8b0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,9 +47,9 @@ async def create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """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. @@ -63,7 +63,7 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,9 +117,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -133,7 +133,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +241,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -253,7 +253,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -298,10 +298,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """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. @@ -317,7 +317,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -373,7 +373,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -386,7 +386,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -448,7 +448,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -458,7 +458,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -518,7 +518,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -526,7 +526,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -598,7 +598,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -725,7 +725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -743,7 +749,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -753,7 +759,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -814,9 +820,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -826,7 +832,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py index 1fbb79dc295f..a79b444664cc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py @@ -455,7 +455,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py index b231c15bf5f9..2c117ce90fba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -497,7 +497,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py index b087fb97fafd..8989c9aad003 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index ea01754d4679..6fed1d21cbd5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,10 +51,10 @@ def create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """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. @@ -68,7 +68,7 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,10 +122,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -139,7 +139,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +249,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -261,7 +261,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,11 +306,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """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. @@ -326,7 +326,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -383,7 +383,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -396,7 +396,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -459,7 +459,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -469,7 +469,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -530,7 +530,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -538,7 +538,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -599,7 +599,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -611,7 +611,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -740,7 +740,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -759,7 +765,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -769,7 +775,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -830,10 +836,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -843,7 +849,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json index 00161d1fdf3b..b12e3a760e0c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py index 62e0af9fc08d..6fc5c295d786 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index af40df162584..d08e1b0c79ba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """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. @@ -63,7 +63,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,9 +110,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """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. @@ -129,7 +129,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +185,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +241,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """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. @@ -262,7 +262,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +287,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py index f3618351063c..0674b3a6eafa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index caf32c967e86..883a95f2fcce 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> AsyncLROPoller["_models.Vault"]: """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. @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -293,7 +299,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +311,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +356,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """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. @@ -369,7 +375,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +431,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +444,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +506,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +516,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +576,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +584,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +644,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +656,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -777,7 +783,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +807,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +817,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +878,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +890,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 cbd89c41565d..1b2e27f0780f 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 @@ -759,7 +759,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] 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 5031dac2eee9..d1cc5f8261ba 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 @@ -822,7 +822,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py index 8aa8659f2726..3a1d9d80ba63 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index 071b41a122b6..7094e667498c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """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. @@ -68,7 +68,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,10 +115,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """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. @@ -135,7 +135,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +192,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +249,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """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. @@ -270,7 +270,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +295,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py index f73134a89fd7..ef08089bc1a9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 2aa1aee90fba..8278b78bf323 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # type: (...) -> LROPoller["_models.Vault"] """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. @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -302,7 +308,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +320,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +365,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """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. @@ -379,7 +385,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +442,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +455,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +518,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +528,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +589,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,7 +597,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +658,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +670,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -793,7 +799,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +824,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +834,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +895,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +908,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 002dd4926bf8..e56da6c459a1 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 @@ -22,6 +22,7 @@ from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import Operations +from .operations import KeysOperations from . import models @@ -36,6 +37,8 @@ class KeyVaultManagementClient(object): :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: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2019_09_01.operations.KeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -69,6 +72,8 @@ 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) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json index b52026f36224..67349a41b050 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true @@ -54,7 +55,8 @@ "vaults": "VaultsOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "private_link_resources": "PrivateLinkResourcesOperations", - "operations": "Operations" + "operations": "Operations", + "keys": "KeysOperations" }, "operation_mixins": { }, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py index 0f6a9e5ab2dd..7bd14f63a4f9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py @@ -20,6 +20,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(object): :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations.Operations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2019_09_01.aio.operations.KeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. @@ -66,6 +69,8 @@ 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) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py index ad4413dd4cae..7b62b7166158 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py @@ -10,10 +10,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/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py new file mode 100644 index 000000000000..9e8312e5083d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py @@ -0,0 +1,399 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations: + """KeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2019_09_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs + ) -> "_models.Key": + """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 parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs + ) -> "_models.Key": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> AsyncIterable["_models.KeyListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + async def get_version( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs + ) -> "_models.Key": + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs + ) -> AsyncIterable["_models.KeyListResult"]: + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py index 63deb155db10..e811c9913ea3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index 75e4e4933218..0993041f36a0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> Optional["_models.PrivateEndpointConnection"]: """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. @@ -60,10 +60,10 @@ async def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """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. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """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. @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py index 79df6ecfec61..9d320374df2d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index b68fb2b7e84b..acc7a08d7755 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> AsyncLROPoller["_models.Vault"]: """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. @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """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. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 118b959ac33a..da5f47d383d0 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 @@ -8,12 +8,18 @@ try: from ._models_py3 import AccessPolicyEntry + from ._models_py3 import Attributes from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import CloudErrorBody from ._models_py3 import DeletedVault from ._models_py3 import DeletedVaultListResult 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 KeyListResult + from ._models_py3 import KeyProperties from ._models_py3 import LogSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation @@ -42,12 +48,18 @@ from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): from ._models import AccessPolicyEntry # type: ignore + from ._models import Attributes # type: ignore from ._models import CheckNameAvailabilityResult # type: ignore from ._models import CloudErrorBody # type: ignore from ._models import DeletedVault # type: ignore from ._models import DeletedVaultListResult # type: ignore from ._models import DeletedVaultProperties # type: ignore from ._models import IPRule # type: ignore + from ._models import Key # type: ignore + from ._models import KeyAttributes # type: ignore + from ._models import KeyCreateParameters # type: ignore + from ._models import KeyListResult # type: ignore + from ._models import KeyProperties # type: ignore from ._models import LogSpecification # type: ignore from ._models import NetworkRuleSet # type: ignore from ._models import Operation # type: ignore @@ -79,6 +91,10 @@ AccessPolicyUpdateKind, CertificatePermissions, CreateMode, + DeletionRecoveryLevel, + JsonWebKeyCurveName, + JsonWebKeyOperation, + JsonWebKeyType, KeyPermissions, NetworkRuleAction, NetworkRuleBypassOptions, @@ -89,16 +105,23 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ 'AccessPolicyEntry', + 'Attributes', 'CheckNameAvailabilityResult', 'CloudErrorBody', 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', 'LogSpecification', 'NetworkRuleSet', 'Operation', @@ -128,6 +151,10 @@ 'AccessPolicyUpdateKind', 'CertificatePermissions', 'CreateMode', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', 'KeyPermissions', 'NetworkRuleAction', 'NetworkRuleBypassOptions', @@ -138,4 +165,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] 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 a56975b172c7..921758eff66a 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 @@ -34,6 +34,7 @@ class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -58,8 +59,51 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" DEFAULT = "default" +class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """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. + """ + + PURGEABLE = "Purgeable" + RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" + RECOVERABLE = "Recoverable" + RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" + +class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + P256 = "P-256" + P384 = "P-384" + P521 = "P-521" + P256_K = "P-256K" + +class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permitted JSON web key operations of the key. For more information, see + JsonWebKeyOperation. + """ + + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + SIGN = "sign" + VERIFY = "verify" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + IMPORT_ENUM = "import" + +class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the key. For valid values, see JsonWebKeyType. + """ + + EC = "EC" + EC_HSM = "EC-HSM" + RSA = "RSA" + RSA_HSM = "RSA-HSM" + class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" ENCRYPT = "encrypt" DECRYPT = "decrypt" WRAP_KEY = "wrapKey" @@ -123,6 +167,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" SET = "set" @@ -147,6 +192,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -161,3 +207,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LISTSAS = "listsas" GETSAS = "getsas" DELETESAS = "deletesas" + +class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" 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 e051addc79e8..767a8eec466e 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 @@ -51,6 +51,57 @@ def __init__( self.permissions = kwargs['permissions'] +class Attributes(msrest.serialization.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(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -191,6 +242,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -199,6 +252,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -207,6 +261,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -219,6 +274,7 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None class IPRule(msrest.serialization.Model): @@ -247,6 +303,272 @@ def __init__( self.value = kwargs['value'] +class Resource(msrest.serialization.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: A set of 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: A set of 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.Attributes + :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}, + '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': 'Attributes'}, + '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(msrest.serialization.Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of 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['properties'] + + +class KeyListResult(msrest.serialization.Model): + """The page of keys. + + :param value: The key resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :param next_link: The URL to get the next page of keys. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Key]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class KeyProperties(msrest.serialization.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.Attributes + :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 = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'Attributes'}, + '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(msrest.serialization.Model): """Log specification of operation. @@ -318,6 +640,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ @@ -326,6 +650,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -337,6 +662,7 @@ def __init__( self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) + self.is_data_action = kwargs.get('is_data_action', None) self.service_specification = kwargs.get('service_specification', None) @@ -450,51 +776,6 @@ def __init__( self.id = None -class Resource(msrest.serialization.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: A set of 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. @@ -510,6 +791,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -536,6 +819,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', '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'}, @@ -546,6 +830,7 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) 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 = None @@ -669,15 +954,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.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 + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -687,7 +972,7 @@ def __init__( 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) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -759,7 +1044,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1097,7 +1382,8 @@ class VaultProperties(msrest.serialization.Model): ``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. + :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. @@ -1134,6 +1420,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1160,6 +1449,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1181,6 +1471,7 @@ def __init__( 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.provisioning_state = kwargs.get('provisioning_state', None) self.private_endpoint_connections = None 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 b369d2e9008b..180780340cb8 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 @@ -60,6 +60,61 @@ def __init__( self.permissions = permissions +class Attributes(msrest.serialization.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: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + **kwargs + ): + 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(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -208,6 +263,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -216,6 +273,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -224,6 +282,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -236,6 +295,7 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None class IPRule(msrest.serialization.Model): @@ -266,6 +326,294 @@ def __init__( self.value = value +class Resource(msrest.serialization.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: A set of 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: A set of 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.Attributes + :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}, + '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': 'Attributes'}, + '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: Optional["Attributes"] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): + 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: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + **kwargs + ): + super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + + +class KeyCreateParameters(msrest.serialization.Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of 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: "KeyProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class KeyListResult(msrest.serialization.Model): + """The page of keys. + + :param value: The key resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :param next_link: The URL to get the next page of keys. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Key]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Key"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(KeyListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class KeyProperties(msrest.serialization.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.Attributes + :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 = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'Attributes'}, + '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: Optional["Attributes"] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): + 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(msrest.serialization.Model): """Log specification of operation. @@ -346,6 +694,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ @@ -354,6 +704,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -363,6 +714,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -370,6 +722,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -496,51 +849,6 @@ def __init__( self.id = None -class Resource(msrest.serialization.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: A set of 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. @@ -556,6 +864,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -582,6 +892,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', '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'}, @@ -590,11 +901,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -725,15 +1038,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.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 + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -741,13 +1054,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -822,7 +1135,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1198,7 +1511,8 @@ class VaultProperties(msrest.serialization.Model): ``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. + :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. @@ -1235,6 +1549,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1261,6 +1578,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1280,6 +1598,7 @@ def __init__( create_mode: Optional[Union[str, "CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, network_acls: Optional["NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1296,6 +1615,7 @@ def __init__( self.create_mode = create_mode self.enable_purge_protection = enable_purge_protection self.network_acls = network_acls + self.provisioning_state = provisioning_state self.private_endpoint_connections = None 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 ad4413dd4cae..7b62b7166158 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 @@ -10,10 +10,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..61c2db2715f0 --- /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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations(object): + """KeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2019_09_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_if_not_exist( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + parameters, # type: "_models.KeyCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """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 parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + def get_version( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + 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 = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py index a7393136ec23..13cf909f52bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 6634d6a13037..ae134f876d44 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> Optional["_models.PrivateEndpointConnection"] """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. @@ -65,10 +65,10 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """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. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """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. @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py index f28d08707d8c..c0630a4d1a68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index 75eecc42fc3d..daf2ae4ea2d6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # type: (...) -> LROPoller["_models.Vault"] """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. @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """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. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json index 2fd2010f7828..ccaaa64f7e09 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json @@ -8,32 +8,33 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": true }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential, # type: \"AsyncTokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index 1a392de5cdd1..564430cc49ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ManagedHsmsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> "models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -86,7 +86,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -105,9 +105,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> AsyncLROPoller["models.ManagedHsm"]: + ) -> AsyncLROPoller["_models.ManagedHsm"]: """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. @@ -127,7 +127,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -152,7 +152,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,10 +176,10 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> "models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -209,7 +215,7 @@ async def _update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -228,9 +234,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> AsyncLROPoller["models.ManagedHsm"]: + ) -> AsyncLROPoller["_models.ManagedHsm"]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -250,7 +256,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -275,7 +281,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -326,7 +338,7 @@ async def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -378,7 +390,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -397,7 +415,7 @@ async def get( resource_group_name: str, name: str, **kwargs - ) -> "models.ManagedHsm": + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -406,10 +424,10 @@ async def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedHsm, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -438,12 +456,14 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -456,7 +476,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -469,7 +489,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -517,7 +537,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -532,7 +552,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -543,7 +563,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +610,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py index b7fd0a186d42..5447f3c801ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 8cfd0cd24389..49dbd7885cd2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> Optional["_models.PrivateEndpointConnection"]: """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. @@ -60,10 +60,10 @@ async def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """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. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """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. @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py index a1fca642a74f..f79276b397ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index 54fb6c383db7..e2a28bbdbe7f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> AsyncLROPoller["_models.Vault"]: """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. @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """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. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 index bf8ab6a200c3..498b10fd4066 100644 --- 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 @@ -106,6 +106,7 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ @@ -165,4 +166,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] 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 index 89443ea901e9..a523661d384c 100644 --- 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 @@ -34,6 +34,7 @@ class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -60,6 +61,7 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" ENCRYPT = "encrypt" DECRYPT = "decrypt" WRAP_KEY = "wrapKey" @@ -149,6 +151,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" SET = "set" @@ -173,6 +176,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -187,3 +191,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LISTSAS = "listsas" GETSAS = "getsas" DELETESAS = "deletesas" + +class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" 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 index 948fc2a0038a..1257e529e029 100644 --- 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 @@ -192,6 +192,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -200,6 +202,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -208,6 +211,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -220,6 +224,7 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None class Error(msrest.serialization.Model): @@ -461,8 +466,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: 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 @@ -489,6 +494,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -512,10 +518,10 @@ def __init__( 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 = kwargs.get('hsm_uri', 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', None) + 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 @@ -548,7 +554,7 @@ def __init__( **kwargs ): super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "B") self.name = kwargs['name'] @@ -597,6 +603,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification @@ -606,6 +614,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -617,6 +626,7 @@ def __init__( self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) + self.is_data_action = kwargs.get('is_data_action', None) self.service_specification = kwargs.get('service_specification', None) @@ -791,6 +801,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: 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. @@ -817,6 +829,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', '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'}, @@ -827,6 +840,7 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) 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 = None @@ -950,15 +964,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~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 + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -968,7 +982,7 @@ def __init__( 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) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -1041,7 +1055,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1379,7 +1393,8 @@ class VaultProperties(msrest.serialization.Model): ``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. + :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. @@ -1416,6 +1431,10 @@ class VaultProperties(msrest.serialization.Model): :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 + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1442,6 +1461,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1463,6 +1483,7 @@ def __init__( 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.provisioning_state = kwargs.get('provisioning_state', None) self.private_endpoint_connections = 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 index 4b587f953ad7..7183be07cf29 100644 --- 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 @@ -209,6 +209,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -217,6 +219,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -225,6 +228,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -237,6 +241,7 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None class Error(msrest.serialization.Model): @@ -496,8 +501,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: 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 @@ -524,6 +529,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -545,17 +551,16 @@ def __init__( *, tenant_id: Optional[str] = None, initial_admin_object_ids: Optional[List[str]] = None, - hsm_uri: Optional[str] = None, enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, - enable_purge_protection: Optional[bool] = None, + enable_purge_protection: Optional[bool] = True, create_mode: Optional[Union[str, "CreateMode"]] = None, **kwargs ): super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids - self.hsm_uri = hsm_uri + 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 @@ -589,7 +594,7 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"], + family: Union[str, "ManagedHsmSkuFamily"] = "B", name: Union[str, "ManagedHsmSkuName"], **kwargs ): @@ -648,6 +653,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification @@ -657,6 +664,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -666,6 +674,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -673,6 +682,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -860,6 +870,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: 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. @@ -886,6 +898,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', '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'}, @@ -894,11 +907,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -1029,15 +1044,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~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 + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -1045,13 +1060,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -1127,7 +1142,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1503,7 +1518,8 @@ class VaultProperties(msrest.serialization.Model): ``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. + :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. @@ -1540,6 +1556,10 @@ class VaultProperties(msrest.serialization.Model): :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 + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1566,6 +1586,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1585,6 +1606,7 @@ def __init__( create_mode: Optional[Union[str, "CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, network_acls: Optional["NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1601,6 +1623,7 @@ def __init__( self.create_mode = create_mode self.enable_purge_protection = enable_purge_protection self.network_acls = network_acls + self.provisioning_state = provisioning_state self.private_endpoint_connections = None 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 index f4470695b919..ea3a66552afd 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ManagedHsmsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,10 +110,10 @@ def begin_create_or_update( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ManagedHsm"] + # type: (...) -> LROPoller["_models.ManagedHsm"] """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. @@ -133,7 +133,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -158,7 +158,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,11 +182,11 @@ def _update_initial( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -216,7 +222,7 @@ def _update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -235,10 +241,10 @@ def begin_update( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ManagedHsm"] + # type: (...) -> LROPoller["_models.ManagedHsm"] """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -258,7 +264,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -283,7 +289,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -335,7 +347,7 @@ def _delete_initial( if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -388,7 +400,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -408,7 +426,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" + # type: (...) -> Optional["_models.ManagedHsm"] """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -417,10 +435,10 @@ def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedHsm, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,12 +467,14 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -468,7 +488,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -481,7 +501,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -529,7 +549,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -545,7 +565,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -556,7 +576,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -603,7 +623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 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 index d5352d2ccd47..41b8ad4cbfdc 100644 --- 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 @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 index 613b6990116e..12432fadfcc1 100644 --- 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 @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> Optional["_models.PrivateEndpointConnection"] """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. @@ -65,10 +65,10 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """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. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """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. @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: 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 index dc2dd1396d84..b8745ac3ead7 100644 --- 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 @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } 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 index 8a47698f6909..a4e73f2c4b5e 100644 --- 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 @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # type: (...) -> LROPoller["_models.Vault"] """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. @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """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. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError }