From 51bae99dcca0b8f4ea0c090ae5c1db2e2ecf9948 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 5 Apr 2021 14:12:38 +0000 Subject: [PATCH] CodeGen from PR 13765 in Azure/azure-rest-api-specs Merge 0872f5a23731689cf31594fee0a4d72228f7fbc1 into 32e8a702a2c7807a56466d060034ec85ed5f7ac8 --- sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in | 1 + sdk/keyvault/azure-mgmt-keyvault/_meta.json | 8 + .../azure/mgmt/keyvault/_configuration.py | 7 +- .../keyvault/_key_vault_management_client.py | 38 +- .../azure/mgmt/keyvault/aio/_configuration.py | 9 +- .../aio/_key_vault_management_client.py | 40 +- .../_key_vault_management_client.py | 1 + .../mgmt/keyvault/v2016_10_01/_metadata.json | 73 ++- .../aio/_key_vault_management_client.py | 1 + .../v2016_10_01/aio/operations/_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 66 ++- .../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 | 66 ++- .../_key_vault_management_client.py | 1 + .../mgmt/keyvault/v2018_02_14/_metadata.json | 73 ++- .../aio/_key_vault_management_client.py | 1 + .../v2018_02_14/aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 35 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 84 +-- .../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 | 35 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 84 +-- .../_key_vault_management_client.py | 6 + .../mgmt/keyvault/v2019_09_01/_metadata.json | 76 ++- .../aio/_key_vault_management_client.py | 6 + .../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 | 43 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 88 +-- .../keyvault/v2019_09_01/models/__init__.py | 34 ++ .../_key_vault_management_client_enums.py | 53 ++ .../keyvault/v2019_09_01/models/_models.py | 503 ++++++++++++++-- .../v2019_09_01/models/_models_py3.py | 554 ++++++++++++++++-- .../v2019_09_01/operations/__init__.py | 2 + .../operations/_keys_operations.py | 408 +++++++++++++ .../v2019_09_01/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 43 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 88 +-- .../_key_vault_management_client.py | 1 + .../v2020_04_01_preview/_metadata.json | 73 ++- .../aio/_key_vault_management_client.py | 1 + .../operations/_managed_hsms_operations.py | 96 +-- .../aio/operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 43 +- .../_private_link_resources_operations.py | 8 +- .../aio/operations/_vaults_operations.py | 88 +-- .../v2020_04_01_preview/models/__init__.py | 8 + .../_key_vault_management_client_enums.py | 35 +- .../v2020_04_01_preview/models/_models.py | 154 ++++- .../v2020_04_01_preview/models/_models_py3.py | 180 +++++- .../operations/_managed_hsms_operations.py | 96 +-- .../operations/_operations.py | 8 +- ...private_endpoint_connections_operations.py | 43 +- .../_private_link_resources_operations.py | 8 +- .../operations/_vaults_operations.py | 88 +-- 64 files changed, 3240 insertions(+), 714 deletions(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/_meta.json 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/MANIFEST.in b/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in +++ b/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json new file mode 100644 index 000000000000..226abc46f719 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.0.6369", + "use": "@autorest/python@5.6.2", + "commit": "1e48abadb067bd31c3ba8c8d8253919e138dde0c", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.6.2 --version=3.0.6369", + "readme": "specification/keyvault/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py index 0a131b868ca1..5d1c3482be02 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,11 @@ from ._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential class KeyVaultManagementClientConfiguration(Configuration): """Configuration for KeyVaultManagementClient. diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py index de68ba06247d..b0edcd7e2024 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 @@ -9,13 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import ARMPipelineClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import KeyVaultManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,9 +46,10 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :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. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -59,9 +68,9 @@ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): if not base_url: @@ -100,6 +109,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/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py index 313799f24232..97c53efb3b95 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,9 @@ from .._version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential class KeyVaultManagementClientConfiguration(Configuration): """Configuration for KeyVaultManagementClient. @@ -31,8 +34,8 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str + credential: "AsyncTokenCredential", + subscription_id: str, **kwargs # type: Any ) -> None: if credential is None: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py index a967aa9463c8..afd49e60276f 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 @@ -9,13 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Serializer, Deserializer +from typing import Any, Optional, TYPE_CHECKING +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import KeyVaultManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,9 +44,10 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :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. :type subscription_id: str - :param str api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -57,11 +64,11 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: if not base_url: @@ -100,6 +107,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/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py index 500005a28477..b4494449b218 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py @@ -53,6 +53,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json index 2e4ec38bfc58..40cf8cdbbc6d 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,35 @@ "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": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "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: \"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: 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 @@ -41,21 +44,67 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", "operations": "Operations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py index 88854053a696..ee5493e4b6e8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py @@ -50,6 +50,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py index a542c354f3c3..9b3dbffd14a8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index 735e97e7cd61..fa3faebb1cdc 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 } @@ -695,8 +695,8 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -725,7 +725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -743,7 +749,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -753,7 +759,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -814,9 +820,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -826,7 +832,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py index 1fbb79dc295f..a79b444664cc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py @@ -455,7 +455,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py index b231c15bf5f9..2c117ce90fba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -497,7 +497,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py index b087fb97fafd..8989c9aad003 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index ea01754d4679..4426301d80b9 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 } @@ -710,8 +710,8 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -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/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py index 5ec92f953da4..6a1c90c7b3bc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py @@ -59,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json index 00161d1fdf3b..63f211c3e086 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,35 @@ "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": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "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: \"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: 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 @@ -41,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", @@ -57,7 +104,9 @@ "operations": "Operations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py index 53d3e8f627d3..ae9d6141210f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py @@ -56,6 +56,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py index 62e0af9fc08d..6fc5c295d786 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index af40df162584..528271c3a68c 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. @@ -253,8 +253,8 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -262,7 +262,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +287,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py index f3618351063c..0674b3a6eafa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index caf32c967e86..4c0bbc3df7c0 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) @@ -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 } @@ -747,8 +753,8 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -777,7 +783,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +807,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +817,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +878,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +890,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py index cbd89c41565d..1b2e27f0780f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py @@ -759,7 +759,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 5031dac2eee9..d1cc5f8261ba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -822,7 +822,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py index 8aa8659f2726..3a1d9d80ba63 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index 071b41a122b6..c6c14be270d4 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. @@ -261,8 +261,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -270,7 +270,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +295,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py index f73134a89fd7..ef08089bc1a9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 2aa1aee90fba..a0065188489a 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) @@ -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 } @@ -763,8 +769,8 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -793,7 +799,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +824,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +834,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +895,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +908,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index 002dd4926bf8..732d8583f12b 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. @@ -59,6 +62,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( @@ -69,6 +73,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json index b52026f36224..48f94e1ed509 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,35 @@ "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": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "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: \"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: 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 @@ -41,23 +44,70 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "private_link_resources": "PrivateLinkResourcesOperations", - "operations": "Operations" + "operations": "Operations", + "keys": "KeysOperations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py index 0f6a9e5ab2dd..3b1d68768292 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. @@ -56,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( @@ -66,6 +70,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py index ad4413dd4cae..7b62b7166158 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py @@ -10,10 +10,12 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._keys_operations import KeysOperations __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', + 'KeysOperations', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py new file mode 100644 index 000000000000..9e8312e5083d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py @@ -0,0 +1,399 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations: + """KeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2019_09_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs + ) -> "_models.Key": + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs + ) -> "_models.Key": + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> AsyncIterable["_models.KeyListResult"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + async def get_version( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs + ) -> "_models.Key": + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs + ) -> AsyncIterable["_models.KeyListResult"]: + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py index 63deb155db10..e811c9913ea3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index 75e4e4933218..814ea710d74e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -60,10 +60,10 @@ async def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -253,8 +255,8 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py index 79df6ecfec61..9d320374df2d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index b68fb2b7e84b..56263f5acf32 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -747,8 +757,8 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index 118b959ac33a..bb20570b32f7 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,13 +8,21 @@ 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 DimensionProperties 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 MetricSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -42,13 +50,21 @@ 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 DimensionProperties # 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 MetricSpecification # type: ignore from ._models import NetworkRuleSet # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore @@ -79,6 +95,10 @@ AccessPolicyUpdateKind, CertificatePermissions, CreateMode, + DeletionRecoveryLevel, + JsonWebKeyCurveName, + JsonWebKeyOperation, + JsonWebKeyType, KeyPermissions, NetworkRuleAction, NetworkRuleBypassOptions, @@ -89,17 +109,26 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ 'AccessPolicyEntry', + 'Attributes', 'CheckNameAvailabilityResult', 'CloudErrorBody', 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', + 'DimensionProperties', 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', 'LogSpecification', + 'MetricSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', @@ -128,6 +157,10 @@ 'AccessPolicyUpdateKind', 'CertificatePermissions', 'CreateMode', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', 'KeyPermissions', 'NetworkRuleAction', 'NetworkRuleBypassOptions', @@ -138,4 +171,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index a56975b172c7..921758eff66a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -34,6 +34,7 @@ class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -58,8 +59,51 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" DEFAULT = "default" +class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', + then the object can be permanently deleted by a privileged user; otherwise, only the system can + purge the object at the end of the retention interval. + """ + + PURGEABLE = "Purgeable" + RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" + RECOVERABLE = "Recoverable" + RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" + +class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + P256 = "P-256" + P384 = "P-384" + P521 = "P-521" + P256_K = "P-256K" + +class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permitted JSON web key operations of the key. For more information, see + JsonWebKeyOperation. + """ + + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + SIGN = "sign" + VERIFY = "verify" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + IMPORT_ENUM = "import" + +class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the key. For valid values, see JsonWebKeyType. + """ + + EC = "EC" + EC_HSM = "EC-HSM" + RSA = "RSA" + RSA_HSM = "RSA-HSM" + class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" ENCRYPT = "encrypt" DECRYPT = "decrypt" WRAP_KEY = "wrapKey" @@ -123,6 +167,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" SET = "set" @@ -147,6 +192,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -161,3 +207,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LISTSAS = "listsas" GETSAS = "getsas" DELETESAS = "deletesas" + +class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py index e051addc79e8..89a8a10f22bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py @@ -51,6 +51,57 @@ def __init__( self.permissions = kwargs['permissions'] +class Attributes(msrest.serialization.Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Possible + values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.not_before = kwargs.get('not_before', None) + self.expires = kwargs.get('expires', None) + self.created = None + self.updated = None + self.recovery_level = None + + class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -191,6 +242,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -199,6 +252,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -207,6 +261,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -219,6 +274,35 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) class IPRule(msrest.serialization.Model): @@ -247,6 +331,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.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Key, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + + +class KeyAttributes(Attributes): + """The attributes of the key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Possible + values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyAttributes, self).__init__(**kwargs) + + +class KeyCreateParameters(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.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + + class LogSpecification(msrest.serialization.Model): """Log specification of operation. @@ -274,6 +624,66 @@ def __init__( self.blob_duration = kwargs.get('blob_duration', None) +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of Metric specification. + :type display_name: str + :param display_description: Display description of Metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) + self.dimensions = kwargs.get('dimensions', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + + class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -318,6 +728,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ @@ -326,6 +738,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -337,6 +750,7 @@ def __init__( self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) + self.is_data_action = kwargs.get('is_data_action', None) self.service_specification = kwargs.get('service_specification', None) @@ -450,51 +864,6 @@ def __init__( self.id = None -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - class PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -510,6 +879,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -536,6 +907,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -546,6 +918,7 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None @@ -556,6 +929,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -572,6 +949,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -582,6 +961,8 @@ def __init__( **kwargs ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None @@ -669,15 +1050,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -687,7 +1068,7 @@ def __init__( super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -718,10 +1099,13 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( @@ -730,6 +1114,7 @@ def __init__( ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) class Sku(msrest.serialization.Model): @@ -759,7 +1144,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1097,8 +1482,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool @@ -1134,6 +1522,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1143,6 +1534,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1151,6 +1543,7 @@ class VaultProperties(msrest.serialization.Model): 'sku': {'key': 'sku', 'type': 'Sku'}, 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, @@ -1160,6 +1553,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1172,6 +1566,7 @@ def __init__( self.sku = kwargs['sku'] self.access_policies = kwargs.get('access_policies', None) self.vault_uri = kwargs.get('vault_uri', None) + self.hsm_pool_resource_id = None self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) @@ -1181,6 +1576,7 @@ def __init__( self.create_mode = kwargs.get('create_mode', None) self.enable_purge_protection = kwargs.get('enable_purge_protection', None) self.network_acls = kwargs.get('network_acls', None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.private_endpoint_connections = None @@ -1193,6 +1589,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- vnet/subnets/subnet1'. :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -1201,6 +1600,7 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( @@ -1209,3 +1609,4 @@ def __init__( ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = kwargs['id'] + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index b369d2e9008b..68ac222b0b9f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -60,6 +60,61 @@ def __init__( self.permissions = permissions +class Attributes(msrest.serialization.Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Possible + values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + self.recovery_level = None + + class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -208,6 +263,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -216,6 +273,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -224,6 +282,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -236,6 +295,39 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox class IPRule(msrest.serialization.Model): @@ -266,6 +358,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.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + attributes: Optional["KeyAttributes"] = 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.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + """ + + _validation = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + attributes: Optional["KeyAttributes"] = 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. @@ -297,6 +677,78 @@ def __init__( self.blob_duration = blob_duration +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of Metric specification. + :type display_name: str + :param display_description: Display description of Metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + lock_aggregation_type: Optional[str] = None, + dimensions: Optional[List["DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.lock_aggregation_type = lock_aggregation_type + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.internal_metric_name = internal_metric_name + + class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -346,6 +798,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ @@ -354,6 +808,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -363,6 +818,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -370,6 +826,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -496,51 +953,6 @@ def __init__( self.id = None -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - class PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -556,6 +968,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -582,6 +996,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -590,11 +1005,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -605,6 +1022,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -621,6 +1042,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -629,11 +1052,15 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, + id: Optional[str] = None, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -725,15 +1152,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -741,13 +1168,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -781,20 +1208,25 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( self, *, log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications + self.metric_specifications = metric_specifications class Sku(msrest.serialization.Model): @@ -822,7 +1254,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1198,8 +1630,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool @@ -1235,6 +1670,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1244,6 +1682,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1252,6 +1691,7 @@ class VaultProperties(msrest.serialization.Model): 'sku': {'key': 'sku', 'type': 'Sku'}, 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, @@ -1261,6 +1701,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1280,6 +1721,7 @@ def __init__( create_mode: Optional[Union[str, "CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, network_acls: Optional["NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1287,6 +1729,7 @@ def __init__( self.sku = sku self.access_policies = access_policies self.vault_uri = vault_uri + self.hsm_pool_resource_id = None self.enabled_for_deployment = enabled_for_deployment self.enabled_for_disk_encryption = enabled_for_disk_encryption self.enabled_for_template_deployment = enabled_for_template_deployment @@ -1296,6 +1739,7 @@ def __init__( self.create_mode = create_mode self.enable_purge_protection = enable_purge_protection self.network_acls = network_acls + self.provisioning_state = provisioning_state self.private_endpoint_connections = None @@ -1308,6 +1752,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- vnet/subnets/subnet1'. :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -1316,13 +1763,16 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( self, *, id: str, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index ad4413dd4cae..7b62b7166158 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py @@ -10,10 +10,12 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._keys_operations import KeysOperations __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', + 'KeysOperations', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py new file mode 100644 index 000000000000..61c2db2715f0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py @@ -0,0 +1,408 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations(object): + """KeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2019_09_01.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_if_not_exist( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + parameters, # type: "_models.KeyCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + def get_version( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2019-09-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py index a7393136ec23..13cf909f52bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 6634d6a13037..41f0934c87c6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> Optional["_models.PrivateEndpointConnection"] """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -65,10 +65,10 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -261,8 +263,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py index f28d08707d8c..c0630a4d1a68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index 75eecc42fc3d..34514dc10612 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -763,8 +773,8 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py index bd919b7d3ca8..d3a6247e4892 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py @@ -62,6 +62,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json index 2fd2010f7828..4a5b4ca67989 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,35 @@ "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": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "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: \"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: 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 @@ -41,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", @@ -58,7 +105,9 @@ "managed_hsms": "ManagedHsmsOperations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py index ce6a770f721c..54af762c448c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py @@ -59,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index 1a392de5cdd1..2596b185b1e8 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.failsafe_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. @@ -118,8 +118,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) @@ -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.failsafe_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. @@ -241,8 +247,8 @@ async def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) @@ -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.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -348,8 +360,8 @@ async def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -378,7 +390,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -397,7 +415,7 @@ async def get( resource_group_name: str, name: str, **kwargs - ) -> "models.ManagedHsm": + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -406,10 +424,10 @@ async def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedHsm, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -438,12 +456,14 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -456,7 +476,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -469,7 +489,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -517,7 +537,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -532,7 +552,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -543,7 +563,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +610,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py index b7fd0a186d42..5447f3c801ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 8cfd0cd24389..add077c37bb5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -60,10 +60,10 @@ async def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -253,8 +255,8 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py index a1fca642a74f..f79276b397ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index 54fb6c383db7..ecaefdf0c8ac 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -747,8 +757,8 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py index bf8ab6a200c3..167c19127358 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py @@ -13,6 +13,7 @@ from ._models_py3 import DeletedVault from ._models_py3 import DeletedVaultListResult from ._models_py3 import DeletedVaultProperties + from ._models_py3 import DimensionProperties from ._models_py3 import Error from ._models_py3 import IPRule from ._models_py3 import LogSpecification @@ -22,6 +23,7 @@ from ._models_py3 import ManagedHsmProperties from ._models_py3 import ManagedHsmResource from ._models_py3 import ManagedHsmSku + from ._models_py3 import MetricSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -54,6 +56,7 @@ from ._models import DeletedVault # type: ignore from ._models import DeletedVaultListResult # type: ignore from ._models import DeletedVaultProperties # type: ignore + from ._models import DimensionProperties # type: ignore from ._models import Error # type: ignore from ._models import IPRule # type: ignore from ._models import LogSpecification # type: ignore @@ -63,6 +66,7 @@ from ._models import ManagedHsmProperties # type: ignore from ._models import ManagedHsmResource # type: ignore from ._models import ManagedHsmSku # type: ignore + from ._models import MetricSpecification # type: ignore from ._models import NetworkRuleSet # type: ignore from ._models import Operation # type: ignore from ._models import OperationDisplay # type: ignore @@ -106,6 +110,7 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ @@ -115,6 +120,7 @@ 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', + 'DimensionProperties', 'Error', 'IPRule', 'LogSpecification', @@ -124,6 +130,7 @@ 'ManagedHsmProperties', 'ManagedHsmResource', 'ManagedHsmSku', + 'MetricSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', @@ -165,4 +172,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py index 89443ea901e9..8efdec8db877 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" @@ -130,14 +132,22 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state. """ - SUCCEEDED = "Succeeded" #: The managed HSM Pool has been full provisioned. - PROVISIONING = "Provisioning" #: The managed HSM Pool is currently being provisioned. - FAILED = "Failed" #: Provisioning of the managed HSM Pool has failed. - UPDATING = "Updating" #: The managed HSM Pool is currently being updated. - DELETING = "Deleting" #: The managed HSM Pool is currently being deleted. - ACTIVATED = "Activated" #: The managed HSM pool is ready for normal use. - SECURITY_DOMAIN_RESTORE = "SecurityDomainRestore" #: The managed HSM pool is waiting for a security domain restore action. - RESTORING = "Restoring" #: The managed HSM pool is being restored from full HSM backup. + #: The managed HSM Pool has been full provisioned. + SUCCEEDED = "Succeeded" + #: The managed HSM Pool is currently being provisioned. + PROVISIONING = "Provisioning" + #: Provisioning of the managed HSM Pool has failed. + FAILED = "Failed" + #: The managed HSM Pool is currently being updated. + UPDATING = "Updating" + #: The managed HSM Pool is currently being deleted. + DELETING = "Deleting" + #: The managed HSM pool is ready for normal use. + ACTIVATED = "Activated" + #: The managed HSM pool is waiting for a security domain restore action. + SECURITY_DOMAIN_RESTORE = "SecurityDomainRestore" + #: The managed HSM pool is being restored from full HSM backup. + RESTORING = "Restoring" class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if @@ -149,6 +159,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 +184,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -187,3 +199,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LISTSAS = "listsas" GETSAS = "getsas" DELETESAS = "deletesas" + +class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py index 948fc2a0038a..ecfdb9b7f4d9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py @@ -192,6 +192,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -200,6 +202,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -208,6 +211,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -220,6 +224,35 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) class Error(msrest.serialization.Model): @@ -461,8 +494,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: str + :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. + :vartype hsm_uri: str :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be @@ -489,6 +522,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -512,10 +546,10 @@ def __init__( super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) - self.hsm_uri = kwargs.get('hsm_uri', None) + self.hsm_uri = None self.enable_soft_delete = kwargs.get('enable_soft_delete', True) self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', True) self.create_mode = kwargs.get('create_mode', None) self.status_message = None self.provisioning_state = None @@ -548,10 +582,70 @@ def __init__( **kwargs ): super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "B") self.name = kwargs['name'] +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of Metric specification. + :type display_name: str + :param display_description: Display description of Metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) + self.dimensions = kwargs.get('dimensions', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + + class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -597,6 +691,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification @@ -606,6 +702,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -617,6 +714,7 @@ def __init__( self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) self.origin = kwargs.get('origin', None) + self.is_data_action = kwargs.get('is_data_action', None) self.service_specification = kwargs.get('service_specification', None) @@ -791,6 +889,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -817,6 +917,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -827,6 +928,7 @@ def __init__( **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None @@ -837,6 +939,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -853,6 +959,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -863,6 +971,8 @@ def __init__( **kwargs ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) self.provisioning_state = None @@ -950,15 +1060,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -968,7 +1078,7 @@ def __init__( super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -1000,10 +1110,14 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( @@ -1012,6 +1126,7 @@ def __init__( ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) class Sku(msrest.serialization.Model): @@ -1041,7 +1156,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1379,8 +1494,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool @@ -1416,6 +1534,10 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1425,6 +1547,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1433,6 +1556,7 @@ class VaultProperties(msrest.serialization.Model): 'sku': {'key': 'sku', 'type': 'Sku'}, 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, @@ -1442,6 +1566,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1454,6 +1579,7 @@ def __init__( self.sku = kwargs['sku'] self.access_policies = kwargs.get('access_policies', None) self.vault_uri = kwargs.get('vault_uri', None) + self.hsm_pool_resource_id = None self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) @@ -1463,6 +1589,7 @@ def __init__( self.create_mode = kwargs.get('create_mode', None) self.enable_purge_protection = kwargs.get('enable_purge_protection', None) self.network_acls = kwargs.get('network_acls', None) + self.provisioning_state = kwargs.get('provisioning_state', None) self.private_endpoint_connections = None @@ -1475,6 +1602,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- vnet/subnets/subnet1'. :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -1483,6 +1613,7 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( @@ -1491,3 +1622,4 @@ def __init__( ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = kwargs['id'] + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py index 4b587f953ad7..cbec9e28ec46 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py @@ -209,6 +209,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :vartype scheduled_purge_date: ~datetime.datetime :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool """ _validation = { @@ -217,6 +219,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -225,6 +228,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, } def __init__( @@ -237,6 +241,39 @@ def __init__( self.deletion_date = None self.scheduled_purge_date = None self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox class Error(msrest.serialization.Model): @@ -496,8 +533,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: str + :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. + :vartype hsm_uri: str :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be @@ -524,6 +561,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -545,17 +583,16 @@ def __init__( *, tenant_id: Optional[str] = None, initial_admin_object_ids: Optional[List[str]] = None, - hsm_uri: Optional[str] = None, enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, - enable_purge_protection: Optional[bool] = None, + enable_purge_protection: Optional[bool] = True, create_mode: Optional[Union[str, "CreateMode"]] = None, **kwargs ): super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids - self.hsm_uri = hsm_uri + self.hsm_uri = None self.enable_soft_delete = enable_soft_delete self.soft_delete_retention_in_days = soft_delete_retention_in_days self.enable_purge_protection = enable_purge_protection @@ -589,7 +626,7 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"], + family: Union[str, "ManagedHsmSkuFamily"] = "B", name: Union[str, "ManagedHsmSkuName"], **kwargs ): @@ -598,6 +635,78 @@ def __init__( self.name = name +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of Metric specification. + :type display_name: str + :param display_description: Display description of Metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + lock_aggregation_type: Optional[str] = None, + dimensions: Optional[List["DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.lock_aggregation_type = lock_aggregation_type + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.internal_metric_name = internal_metric_name + + class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -648,6 +757,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay :param origin: The origin of operations. :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool :param service_specification: One property of operation, include metric specifications. :type service_specification: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification @@ -657,6 +768,7 @@ class Operation(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'display': {'key': 'display', 'type': 'OperationDisplay'}, 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } @@ -666,6 +778,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -673,6 +786,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -860,6 +974,8 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -886,6 +1002,7 @@ class PrivateEndpointConnection(Resource): 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -894,11 +1011,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -909,6 +1028,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str :param private_endpoint: Properties of the private endpoint object. :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -925,6 +1048,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -933,11 +1058,15 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, + id: Optional[str] = None, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = None @@ -1029,15 +1158,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -1045,13 +1174,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -1086,20 +1215,26 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( self, *, log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications + self.metric_specifications = metric_specifications class Sku(msrest.serialization.Model): @@ -1127,7 +1262,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1503,8 +1638,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool @@ -1540,6 +1678,10 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1549,6 +1691,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1557,6 +1700,7 @@ class VaultProperties(msrest.serialization.Model): 'sku': {'key': 'sku', 'type': 'Sku'}, 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, @@ -1566,6 +1710,7 @@ class VaultProperties(msrest.serialization.Model): 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } @@ -1585,6 +1730,7 @@ def __init__( create_mode: Optional[Union[str, "CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, network_acls: Optional["NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1592,6 +1738,7 @@ def __init__( self.sku = sku self.access_policies = access_policies self.vault_uri = vault_uri + self.hsm_pool_resource_id = None self.enabled_for_deployment = enabled_for_deployment self.enabled_for_disk_encryption = enabled_for_disk_encryption self.enabled_for_template_deployment = enabled_for_template_deployment @@ -1601,6 +1748,7 @@ def __init__( self.create_mode = create_mode self.enable_purge_protection = enable_purge_protection self.network_acls = network_acls + self.provisioning_state = provisioning_state self.private_endpoint_connections = None @@ -1613,6 +1761,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- vnet/subnets/subnet1'. :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -1621,13 +1772,16 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( self, *, id: str, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py index f4470695b919..062af974b272 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.failsafe_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. @@ -124,8 +124,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) @@ -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.failsafe_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. @@ -249,8 +255,8 @@ def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) @@ -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.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -358,8 +370,8 @@ def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -388,7 +400,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -408,7 +426,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" + # type: (...) -> Optional["_models.ManagedHsm"] """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -417,10 +435,10 @@ def get( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedHsm, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,12 +467,14 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -468,7 +488,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -481,7 +501,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -529,7 +549,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) @@ -545,7 +565,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -556,7 +576,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -603,7 +623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py index d5352d2ccd47..41b8ad4cbfdc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # type: (...) -> Iterable["_models.OperationListResult"] """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py index 613b6990116e..69f772bcda2c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> Optional["_models.PrivateEndpointConnection"] """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -65,10 +65,10 @@ def get( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection, or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_models.PrivateEndpointConnection" """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -261,8 +263,8 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py index dc2dd1396d84..b8745ac3ead7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # type: (...) -> "_models.PrivateLinkResourceListResult" """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py index 8a47698f6909..b294cbe1ac93 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ def update_access_policy( self, resource_group_name, # type: str vault_name, # type: str - operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] - parameters, # type: "models.VaultAccessPolicyParameters" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # type: (...) -> "_models.VaultAccessPolicyParameters" """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # type: (...) -> Iterable["_models.DeletedVaultListResult"] """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -763,8 +773,8 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError }