From 57c559a3323620da993d57e4d76619644efa5902 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 4 Dec 2020 23:34:50 +0000 Subject: [PATCH] CodeGen from PR 11964 in Azure/azure-rest-api-specs Merge d2568566fb403649f7f057356851d964bebf19be into 7184ee0b5506063fd3c800cc2e08f31ca88333e6 --- .../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 | 31 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 76 ++-- .../keyvault/v2019_09_01/models/__init__.py | 26 ++ .../_key_vault_management_client_enums.py | 46 ++ .../keyvault/v2019_09_01/models/_models.py | 364 ++++++++++++++-- .../v2019_09_01/models/_models_py3.py | 390 +++++++++++++++-- .../v2019_09_01/operations/__init__.py | 2 + .../operations/_keys_operations.py | 408 ++++++++++++++++++ .../v2019_09_01/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 31 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 76 ++-- .../v2020_04_01_preview/_metadata.json | 15 +- .../operations/_managed_hsms_operations.py | 76 ++-- .../aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 31 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 76 ++-- .../_key_vault_management_client_enums.py | 4 + .../v2020_04_01_preview/models/_models.py | 4 +- .../v2020_04_01_preview/models/_models_py3.py | 4 +- .../operations/_managed_hsms_operations.py | 76 ++-- .../operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 31 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 76 ++-- 53 files changed, 2223 insertions(+), 563 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 de68ba06247df..07dcdec5649de 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 a967aa9463c85..8373723c2709c 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 2e4ec38bfc582..08d8133877c7b 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 a542c354f3c38..9b3dbffd14a8e 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 735e97e7cd61a..b6312b6ef8b05 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 1fbb79dc295fb..a79b444664cc0 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 b231c15bf5f9d..2c117ce90fbac 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 b087fb97fafd5..8989c9aad0032 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 ea01754d46792..6fed1d21cbd5f 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 00161d1fdf3b5..b12e3a760e0c7 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 62e0af9fc08da..6fc5c295d7863 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 af40df1625842..d08e1b0c79ba2 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 f3618351063ce..0674b3a6eafa0 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 caf32c967e861..883a95f2fcce5 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 cbd89c41565d4..1b2e27f0780fd 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 5031dac2eee96..d1cc5f8261ba5 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 8aa8659f2726a..3a1d9d80ba63a 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 071b41a122b68..7094e667498ca 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 f73134a89fd7d..ef08089bc1a92 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 2aa1aee90fba4..8278b78bf323f 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 002dd4926bf85..e56da6c459a1c 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 b52026f36224e..67349a41b0504 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 0f6a9e5ab2dd7..7bd14f63a4f96 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 ad4413dd4caea..7b62b7166158f 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 0000000000000..9e8312e5083df --- /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 63deb155db101..e811c9913ea30 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 75e4e49332184..8ef4c6d063654 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": + ) -> "_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.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 } @@ -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.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 +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/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 79df6ecfec61e..9d320374df2dd 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 b68fb2b7e84b8..96493078db798 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 } @@ -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.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 +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.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 +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.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 +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.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 +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.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 +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.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 } @@ -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.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 +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.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 118b959ac33a1..884bc0db91547 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, @@ -93,12 +109,18 @@ __all__ = [ 'AccessPolicyEntry', + 'Attributes', 'CheckNameAvailabilityResult', 'CloudErrorBody', 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', 'LogSpecification', 'NetworkRuleSet', 'Operation', @@ -128,6 +150,10 @@ 'AccessPolicyUpdateKind', 'CertificatePermissions', 'CreateMode', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', 'KeyPermissions', 'NetworkRuleAction', 'NetworkRuleBypassOptions', 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 a56975b172c70..636dc93054014 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" 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 e051addc79e8a..e9307faf3303a 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. @@ -247,6 +298,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. @@ -450,51 +767,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. @@ -759,7 +1031,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/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index b369d2e9008bb..8cc3821496b00 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. @@ -266,6 +321,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. @@ -496,51 +839,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. @@ -822,7 +1120,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/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index ad4413dd4caea..7b62b7166158f 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 0000000000000..61c2db2715f05 --- /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 a7393136ec237..13cf909f52bd0 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 6634d6a13037b..b0b842fced202 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: (...) -> "_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.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 } @@ -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.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 +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/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 f28d08707d8cd..c0630a4d1a688 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 75eecc42fc3d4..2363f3dec1a09 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 } @@ -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.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 +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.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 +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.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 +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.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 +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.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 +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.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 } @@ -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.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 +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.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 2fd2010f7828c..ccaaa64f7e09d 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 1a392de5cdd14..ff46a110df93b 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": + ) -> "_models.ManagedHsm": """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -409,7 +427,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -440,7 +458,7 @@ async def get( if response.status_code not in [200]: 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) @@ -456,7 +474,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 +487,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 +535,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 +550,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 +561,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 +608,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 b7fd0a186d423..5447f3c801ac6 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 8cfd0cd243897..6ea3b670736a8 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": + ) -> "_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.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 } @@ -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.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 +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/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 a1fca642a74fc..f79276b397ac2 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 54fb6c383db73..7e694ae25307f 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 } @@ -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.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 +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.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 +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.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 +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.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 +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.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 +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.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 } @@ -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.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 +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.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/_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 89443ea901e95..2b90b42460ea7 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" 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 948fc2a0038a2..a07839563614a 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 @@ -548,7 +548,7 @@ def __init__( **kwargs ): super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "B") self.name = kwargs['name'] @@ -1041,7 +1041,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/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 4b587f953ad73..91fad7adc4a23 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 @@ -589,7 +589,7 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"], + family: Union[str, "ManagedHsmSkuFamily"] = "B", name: Union[str, "ManagedHsmSkuName"], **kwargs ): @@ -1127,7 +1127,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/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 f4470695b9190..b539ceb545fc8 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: (...) -> "_models.ManagedHsm" """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -420,7 +438,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -451,7 +469,7 @@ def get( if response.status_code not in [200]: 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) @@ -468,7 +486,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 +499,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 +547,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 +563,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 +574,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 +621,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 d5352d2ccd47c..41b8ad4cbfdc8 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 613b6990116e6..0b3ef21fcbfa9 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: (...) -> "_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.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 } @@ -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.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 +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/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 dc2dd1396d846..b8745ac3ead7c 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 8a47698f69096..594eb02b59c3e 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 } @@ -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.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 +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.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 +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.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 +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.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 +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.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 +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.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 } @@ -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.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 +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.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 }