From 71c9a31c89077bc14eb4d073fa63250f0acfe1a9 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Mon, 18 May 2020 11:03:12 +0200 Subject: [PATCH 1/9] updated keyvault --- sdk/keyvault/azure-mgmt-keyvault/README.md | 4 +- .../azure/mgmt/keyvault/__init__.py | 15 +- .../azure/mgmt/keyvault/_configuration.py | 66 +- .../keyvault/_key_vault_management_client.py | 56 +- .../azure/mgmt/keyvault/_version.py | 8 + .../azure/mgmt/keyvault/py.typed | 1 + .../mgmt/keyvault/v2016_10_01/__init__.py | 15 +- .../keyvault/v2016_10_01/_configuration.py | 74 +- .../_key_vault_management_client.py | 63 +- .../mgmt/keyvault/v2016_10_01/_metadata.json | 39 + .../aio/__init__.py} | 11 +- .../v2016_10_01/aio/_configuration_async.py | 60 ++ .../aio/_key_vault_management_client_async.py | 63 ++ .../aio/operations_async/__init__.py} | 14 +- .../aio/operations_async/_operations_async.py | 100 ++ .../_vaults_operations_async.py | 825 +++++++++++++++ .../keyvault/v2016_10_01/models/__init__.py | 86 +- .../_key_vault_management_client_enums.py | 30 +- .../keyvault/v2016_10_01/models/_models.py | 505 +++++---- .../v2016_10_01/models/_models_py3.py | 590 +++++++---- .../v2016_10_01/models/_paged_models.py | 66 -- .../v2016_10_01/operations/__init__.py | 7 +- .../v2016_10_01/operations/_operations.py | 99 +- .../operations/_vaults_operations.py | 904 ++++++++--------- .../azure/mgmt/keyvault/v2016_10_01/py.typed | 1 + .../mgmt/keyvault/v2018_02_14/__init__.py | 15 +- .../keyvault/v2018_02_14/_configuration.py | 74 +- .../_key_vault_management_client.py | 71 +- .../mgmt/keyvault/v2018_02_14/_metadata.json | 41 + .../aio/__init__.py} | 11 +- .../v2018_02_14/aio/_configuration_async.py | 60 ++ .../aio/_key_vault_management_client_async.py | 73 ++ .../aio/operations_async/__init__.py | 19 + .../aio/operations_async/_operations_async.py | 100 ++ ...e_endpoint_connections_operations_async.py | 280 +++++ ...private_link_resources_operations_async.py | 96 ++ .../_vaults_operations_async.py | 863 ++++++++++++++++ .../keyvault/v2018_02_14/models/__init__.py | 115 ++- .../_key_vault_management_client_enums.py | 74 +- .../keyvault/v2018_02_14/models/_models.py | 718 +++++++------ .../v2018_02_14/models/_models_py3.py | 828 +++++++++------ .../v2018_02_14/models/_paged_models.py | 66 -- .../v2018_02_14/operations/__init__.py | 7 +- .../v2018_02_14/operations/_operations.py | 99 +- ...private_endpoint_connections_operations.py | 335 +++--- .../_private_link_resources_operations.py | 91 +- .../operations/_vaults_operations.py | 954 +++++++++--------- .../azure/mgmt/keyvault/v2018_02_14/py.typed | 1 + .../mgmt/keyvault/v2019_09_01/__init__.py | 15 +- .../keyvault/v2019_09_01/_configuration.py | 74 +- .../_key_vault_management_client.py | 71 +- .../mgmt/keyvault/v2019_09_01/_metadata.json | 41 + .../aio/__init__.py} | 11 +- .../v2019_09_01/aio/_configuration_async.py | 60 ++ .../aio/_key_vault_management_client_async.py | 73 ++ .../aio/operations_async/__init__.py | 19 + .../aio/operations_async/_operations_async.py | 100 ++ ...e_endpoint_connections_operations_async.py | 280 +++++ ...private_link_resources_operations_async.py | 96 ++ .../_vaults_operations_async.py | 863 ++++++++++++++++ .../keyvault/v2019_09_01/models/__init__.py | 115 ++- .../_key_vault_management_client_enums.py | 74 +- .../keyvault/v2019_09_01/models/_models.py | 757 ++++++++------ .../v2019_09_01/models/_models_py3.py | 871 ++++++++++------ .../v2019_09_01/models/_paged_models.py | 66 -- .../v2019_09_01/operations/__init__.py | 7 +- .../v2019_09_01/operations/_operations.py | 99 +- ...private_endpoint_connections_operations.py | 335 +++--- .../_private_link_resources_operations.py | 91 +- .../operations/_vaults_operations.py | 954 +++++++++--------- .../azure/mgmt/keyvault/v2019_09_01/py.typed | 1 + .../azure-mgmt-keyvault/dev_requirements.txt | 1 - .../azure-mgmt-keyvault/sdk_packaging.toml | 8 +- sdk/keyvault/azure-mgmt-keyvault/setup.py | 8 +- .../test_cli_mgmt_keyvault.test_keyvault.yaml | 468 ++++++++- .../tests/test_cli_mgmt_keyvault.py | 40 +- 76 files changed, 9669 insertions(+), 4622 deletions(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/py.typed create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/{v2019_09_01/version.py => v2016_10_01/aio/__init__.py} (71%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/{v2018_02_14/version.py => v2016_10_01/aio/operations_async/__init__.py} (67%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_paged_models.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/py.typed create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/{v2016_10_01/version.py => v2018_02_14/aio/__init__.py} (71%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_paged_models.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/py.typed create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json rename sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/{version.py => v2019_09_01/aio/__init__.py} (71%) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/py.typed delete mode 100644 sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt diff --git a/sdk/keyvault/azure-mgmt-keyvault/README.md b/sdk/keyvault/azure-mgmt-keyvault/README.md index 8a65fe7aee2e..364ed03365cb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/README.md +++ b/sdk/keyvault/azure-mgmt-keyvault/README.md @@ -1,13 +1,13 @@ # Microsoft Azure SDK for Python -This is the Microsoft Azure Key Vault Management Client Library. +This is the Microsoft Azure MyService Management Client Library. This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) # Usage -For code examples, see [Key Vault Management](https://docs.microsoft.com/python/api/overview/azure/key-vault) +For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/) on docs.microsoft.com. diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py index 689af4ca294b..f54ed88d6ad2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py @@ -1,19 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultManagementClientConfiguration from ._key_vault_management_client import KeyVaultManagementClient -__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION - +__all__ = ['KeyVaultManagementClient'] 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 71d3bade9787..1d8bc19817d8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -8,43 +8,57 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration +from typing import Any -from .version import VERSION +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from ._version import VERSION + + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. -class KeyVaultManagementClientConfiguration(AzureConfiguration): - """Configuration for KeyVaultManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(KeyVaultManagementClientConfiguration, self).__init__(base_url) + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') - - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) 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 4bb52389f83f..25e735d388dd 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,33 +9,34 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient +from azure.mgmt.core import ARMPipelineClient from msrest import Serializer, Deserializer from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin from ._configuration import KeyVaultManagementClientConfiguration +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass - -class KeyVaultManagementClient(MultiApiClientMixin, SDKClient): +class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. - This ready contains multiple API versions, to help you deal with all Azure clouds + This ready contains multiple API versions, to help you deal with all of the Azure clouds (Azure Stack, Azure Government, Azure China, etc.). - By default, uses latest API version available on public Azure. - For production, you should stick a particular api-version and/or profile. - The profile sets a mapping between the operation group and an API version. + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. The api-version parameter sets the default API version if the operation group is not described in the profile. - :ivar config: Configuration for client. - :vartype config: KeyVaultManagementClientConfiguration - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify + :param credential: Credential needed for the client to connect to Azure. + :type credential: azure.core.credentials.TokenCredential + :param subscription_id: Subscription credential which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str @@ -55,11 +56,14 @@ class KeyVaultManagementClient(MultiApiClientMixin, SDKClient): _PROFILE_TAG + " latest" ) - def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default): - self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url) + def __init__(self, credential, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default, **kwargs): + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(KeyVaultManagementClient, self).__init__( - credentials, - self.config, + credential, + self._config, api_version=api_version, profile=profile ) @@ -104,7 +108,7 @@ def operations(self): from .v2019_09_01.operations import Operations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def private_endpoint_connections(self): @@ -120,7 +124,7 @@ def private_endpoint_connections(self): from .v2019_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def private_link_resources(self): @@ -136,7 +140,7 @@ def private_link_resources(self): from .v2019_09_01.operations import PrivateLinkResourcesOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @property def vaults(self): @@ -155,4 +159,12 @@ def vaults(self): from .v2019_09_01.operations import VaultsOperations as OperationClass else: raise NotImplementedError("APIVersion {} is not available".format(api_version)) - return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + def close(self): + self._client.close() + def __enter__(self): + self._client.__enter__() + return self + def __exit__(self, *exc_details): + self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py new file mode 100644 index 000000000000..bb9696095add --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py @@ -0,0 +1,8 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "3.0.0b1" \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py index 689af4ca294b..f54ed88d6ad2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py @@ -1,19 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultManagementClientConfiguration from ._key_vault_management_client import KeyVaultManagementClient -__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION - +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py index 71d3bade9787..174f81c5a513 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py @@ -1,50 +1,62 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import Any +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. -class KeyVaultManagementClientConfiguration(AzureConfiguration): - """Configuration for KeyVaultManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(KeyVaultManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2016-10-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) 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 6a67ac58223b..f7393a4018f4 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 @@ -1,16 +1,15 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import Any, Optional + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations @@ -18,39 +17,51 @@ from . import models -class KeyVaultManagementClient(SDKClient): +class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. - :ivar config: Configuration for client. - :vartype config: KeyVaultManagementClientConfiguration - - :ivar vaults: Vaults operations + :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2016_10_01.operations.VaultsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url) - super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2016-10-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) 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 new file mode 100644 index 000000000000..ed02534b138e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json @@ -0,0 +1,39 @@ +{ + "chosen_version": "2016-10-01", + "total_api_version_list": ["2016-10-01"], + "client": { + "name": "KeyVaultManagementClient", + "filename": "_key_vault_management_client", + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "has_subscription_id": true + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "package_version": false, + "global_parameters": { + "method": { + "credential": { + "method_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", + "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 + } + }, + "constant": { + } + } + }, + "operation_groups": { + "vaults": "VaultsOperations", + "operations": "Operations" + }, + "operation_mixins": { + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py similarity index 71% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/version.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py index c438021f6b89..018d48d4060b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py @@ -1,13 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2019-09-01" - +from ._key_vault_management_client_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py new file mode 100644 index 000000000000..5d2c16036fc1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py @@ -0,0 +1,60 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2016-10-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..e05eb8d9dd56 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py @@ -0,0 +1,63 @@ +# 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, Optional + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import Operations +from .. import models + + +class KeyVaultManagementClient(object): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2016_10_01.aio.operations_async.VaultsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2016_10_01.aio.operations_async.Operations + :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. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py similarity index 67% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/version.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py index 289e229b0371..790d8c973d8f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py @@ -1,13 +1,15 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2018-02-14" +from ._vaults_operations_async import VaultsOperations +from ._operations_async import Operations +__all__ = [ + 'VaultsOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..94bbd19f5f80 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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.v2016_10_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 + + def list( + self, + **kwargs + ) -> "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 + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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': '/providers/Microsoft.KeyVault/operations'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..cf20faf1cba5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,825 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations: + """VaultsOperations 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.v2016_10_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_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultPatchParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def delete( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> "models.Vault": + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "models.AccessPolicyUpdateKind"], + parameters: "models.VaultAccessPolicyParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_access_policy.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + + def list_deleted( + self, + **kwargs + ) -> "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 + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + + async def get_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> "models.DeletedVault": + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # Construct URL + url = self.get_deleted.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + + async def _purge_deleted_initial( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.post(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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + async def purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + def list( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.ResourceListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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}/resources'} + + async def check_name_availability( + self, + vault_name: "models.VaultCheckNameAvailabilityParameters", + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py index 32bd8d5ce780..ddd632123fcd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py @@ -1,24 +1,24 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AccessPolicyEntry from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultListResult from ._models_py3 import DeletedVaultProperties from ._models_py3 import LogSpecification from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Permissions from ._models_py3 import Resource + from ._models_py3 import ResourceListResult from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import Vault @@ -26,54 +26,59 @@ from ._models_py3 import VaultAccessPolicyProperties from ._models_py3 import VaultCheckNameAvailabilityParameters from ._models_py3 import VaultCreateOrUpdateParameters + from ._models_py3 import VaultListResult from ._models_py3 import VaultPatchParameters from ._models_py3 import VaultPatchProperties from ._models_py3 import VaultProperties except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry - from ._models import CheckNameAvailabilityResult - from ._models import DeletedVault - from ._models import DeletedVaultProperties - from ._models import LogSpecification - from ._models import Operation - from ._models import OperationDisplay - from ._models import Permissions - from ._models import Resource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import Vault - from ._models import VaultAccessPolicyParameters - from ._models import VaultAccessPolicyProperties - from ._models import VaultCheckNameAvailabilityParameters - from ._models import VaultCreateOrUpdateParameters - from ._models import VaultPatchParameters - from ._models import VaultPatchProperties - from ._models import VaultProperties -from ._paged_models import DeletedVaultPaged -from ._paged_models import OperationPaged -from ._paged_models import ResourcePaged -from ._paged_models import VaultPaged + from ._models import AccessPolicyEntry # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import DeletedVault # type: ignore + from ._models import DeletedVaultListResult # type: ignore + from ._models import DeletedVaultProperties # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import Permissions # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import Vault # type: ignore + from ._models import VaultAccessPolicyParameters # type: ignore + from ._models import VaultAccessPolicyProperties # type: ignore + from ._models import VaultCheckNameAvailabilityParameters # type: ignore + from ._models import VaultCreateOrUpdateParameters # type: ignore + from ._models import VaultListResult # type: ignore + from ._models import VaultPatchParameters # type: ignore + from ._models import VaultPatchProperties # type: ignore + from ._models import VaultProperties # type: ignore + from ._key_vault_management_client_enums import ( - SkuName, - KeyPermissions, - SecretPermissions, + AccessPolicyUpdateKind, CertificatePermissions, - StoragePermissions, CreateMode, + KeyPermissions, Reason, - AccessPolicyUpdateKind, + SecretPermissions, + SkuName, + StoragePermissions, ) __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', 'DeletedVault', + 'DeletedVaultListResult', 'DeletedVaultProperties', 'LogSpecification', 'Operation', 'OperationDisplay', + 'OperationListResult', 'Permissions', 'Resource', + 'ResourceListResult', 'ServiceSpecification', 'Sku', 'Vault', @@ -81,19 +86,16 @@ 'VaultAccessPolicyProperties', 'VaultCheckNameAvailabilityParameters', 'VaultCreateOrUpdateParameters', + 'VaultListResult', 'VaultPatchParameters', 'VaultPatchProperties', 'VaultProperties', - 'VaultPaged', - 'DeletedVaultPaged', - 'ResourcePaged', - 'OperationPaged', - 'SkuName', - 'KeyPermissions', - 'SecretPermissions', + 'AccessPolicyUpdateKind', 'CertificatePermissions', - 'StoragePermissions', 'CreateMode', + 'KeyPermissions', 'Reason', - 'AccessPolicyUpdateKind', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py index 08be1813c36c..0854ac966255 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py @@ -1,23 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from enum import Enum - -class SkuName(str, Enum): - - standard = "standard" - premium = "premium" - - class KeyPermissions(str, Enum): encrypt = "encrypt" @@ -37,7 +27,6 @@ class KeyPermissions(str, Enum): recover = "recover" purge = "purge" - class SecretPermissions(str, Enum): get = "get" @@ -49,7 +38,6 @@ class SecretPermissions(str, Enum): recover = "recover" purge = "purge" - class CertificatePermissions(str, Enum): get = "get" @@ -67,7 +55,6 @@ class CertificatePermissions(str, Enum): recover = "recover" purge = "purge" - class StoragePermissions(str, Enum): get = "get" @@ -85,19 +72,28 @@ class StoragePermissions(str, Enum): getsas = "getsas" deletesas = "deletesas" +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ recover = "recover" default = "default" - class Reason(str, Enum): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ account_name_invalid = "AccountNameInvalid" already_exists = "AlreadyExists" - class AccessPolicyUpdateKind(str, Enum): add = "add" 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 72df3e703a3d..3aba9508f0be 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 @@ -1,35 +1,29 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions """ @@ -46,7 +40,10 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.object_id = kwargs.get('object_id', None) @@ -54,22 +51,20 @@ def __init__(self, **kwargs): self.permissions = kwargs.get('permissions', None) -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -81,30 +76,24 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -112,9 +101,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties """ _validation = { @@ -130,7 +118,10 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -138,21 +129,43 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -172,7 +185,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -181,7 +197,7 @@ def __init__(self, **kwargs): self.tags = None -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -198,26 +214,27 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2016_10_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification """ _attribute_map = { @@ -227,7 +244,10 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -235,7 +255,7 @@ def __init__(self, **kwargs): self.service_specification = kwargs.get('service_specification', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -255,7 +275,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -263,21 +286,40 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] """ _attribute_map = { @@ -287,7 +329,10 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -295,11 +340,10 @@ def __init__(self, **kwargs): self.storage = kwargs.get('storage', None) -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -309,10 +353,9 @@ class Resource(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] """ @@ -331,7 +374,10 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -340,36 +386,59 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ @@ -380,12 +449,15 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) @@ -393,8 +465,7 @@ def __init__(self, **kwargs): class Vault(Resource): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -404,12 +475,11 @@ class Vault(Resource): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ @@ -430,16 +500,18 @@ class Vault(Resource): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Vault, self).__init__(**kwargs) self.properties = kwargs.get('properties', None) -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -451,9 +523,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties """ _validation = { @@ -472,7 +543,10 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -481,16 +555,14 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] """ _validation = { @@ -501,23 +573,25 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = kwargs.get('access_policies', None) -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -533,22 +607,24 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ @@ -563,21 +639,46 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties """ _attribute_map = { @@ -585,48 +686,44 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property specifying whether recoverable - deletion ('soft' delete) is enabled for this key vault. The property may - not be set to false. + :param enable_soft_delete: Property specifying whether recoverable deletion ('soft' delete) is + enabled for this key vault. The property may not be set to false. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault; it is only effective if soft - delete is also enabled. Once activated, the property may no longer be - reset to false. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault; it is only effective if soft delete is also enabled. Once activated, the + property may no longer be reset to false. :type enable_purge_protection: bool """ @@ -638,11 +735,14 @@ class VaultPatchProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -655,53 +755,45 @@ def __init__(self, **kwargs): self.enable_purge_protection = kwargs.get('enable_purge_protection', None) -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property specifying whether recoverable - deletion is enabled for this key vault. Setting this property to true - activates the soft delete feature, whereby vaults or vault entities can be - recovered after deletion. Enabling this functionality is irreversible - + :param enable_soft_delete: Property specifying whether recoverable deletion is enabled for this + key vault. Setting this property to true activates the soft delete feature, whereby vaults or + vault entities can be recovered after deletion. Enabling this functionality is irreversible - that is, the property does not accept false as its value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool """ @@ -719,11 +811,14 @@ class VaultProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) 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 024c000cb5ed..3716345360f6 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 @@ -1,35 +1,31 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from typing import Dict, List, Optional, Union +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. + +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions """ @@ -46,7 +42,15 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "Permissions", + application_id: Optional[str] = None, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -54,22 +58,20 @@ def __init__(self, *, tenant_id: str, object_id: str, permissions, application_i self.permissions = permissions -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -81,30 +83,24 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -112,9 +108,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties """ _validation = { @@ -130,7 +125,12 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeletedVaultProperties"] = None, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -138,21 +138,46 @@ def __init__(self, *, properties=None, **kwargs) -> None: self.properties = properties -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeletedVault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -172,7 +197,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -181,7 +209,7 @@ def __init__(self, **kwargs) -> None: self.tags = None -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -198,26 +226,31 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2016_10_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification """ _attribute_map = { @@ -227,7 +260,15 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -235,7 +276,7 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, service_sp self.service_specification = service_specification -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -255,7 +296,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -263,21 +312,43 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] """ _attribute_map = { @@ -287,7 +358,15 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, **kwargs) -> None: + def __init__( + self, + *, + keys: Optional[List[Union[str, "KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -295,11 +374,10 @@ def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, self.storage = storage -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -309,10 +387,9 @@ class Resource(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] """ @@ -331,7 +408,13 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, location: str, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -340,36 +423,64 @@ def __init__(self, *, location: str, tags=None, **kwargs) -> None: self.tags = tags -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Resource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, *, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ @@ -380,12 +491,17 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, *, name, **kwargs) -> None: + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name @@ -393,8 +509,7 @@ def __init__(self, *, name, **kwargs) -> None: class Vault(Resource): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -404,12 +519,11 @@ class Vault(Resource): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ @@ -430,16 +544,22 @@ class Vault(Resource): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Vault, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -451,9 +571,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties """ _validation = { @@ -472,7 +591,12 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, *, properties, **kwargs) -> None: + def __init__( + self, + *, + properties: "VaultAccessPolicyProperties", + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -481,16 +605,14 @@ def __init__(self, *, properties, **kwargs) -> None: self.properties = properties -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] """ _validation = { @@ -501,23 +623,27 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, *, access_policies, **kwargs) -> None: + def __init__( + self, + *, + access_policies: List["AccessPolicyEntry"], + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -533,22 +659,26 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ @@ -563,21 +693,53 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags self.properties = properties -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Vault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties """ _attribute_map = { @@ -585,48 +747,47 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["VaultPatchProperties"] = None, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property specifying whether recoverable - deletion ('soft' delete) is enabled for this key vault. The property may - not be set to false. + :param enable_soft_delete: Property specifying whether recoverable deletion ('soft' delete) is + enabled for this key vault. The property may not be set to false. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault; it is only effective if soft - delete is also enabled. Once activated, the property may no longer be - reset to false. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault; it is only effective if soft delete is also enabled. Once activated, the + property may no longer be reset to false. :type enable_purge_protection: bool """ @@ -638,11 +799,24 @@ class VaultPatchProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, } - def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, create_mode=None, enable_purge_protection: bool=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: Optional[str] = None, + sku: Optional["Sku"] = None, + access_policies: Optional[List["AccessPolicyEntry"]] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -655,53 +829,45 @@ def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabl self.enable_purge_protection = enable_purge_protection -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :type access_policies: - list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property specifying whether recoverable - deletion is enabled for this key vault. Setting this property to true - activates the soft delete feature, whereby vaults or vault entities can be - recovered after deletion. Enabling this functionality is irreversible - + :param enable_soft_delete: Property specifying whether recoverable deletion is enabled for this + key vault. Setting this property to true activates the soft delete feature, whereby vaults or + vault entities can be recovered after deletion. Enabling this functionality is irreversible - that is, the property does not accept false as its value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool """ @@ -719,11 +885,25 @@ class VaultProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, } - def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, create_mode=None, enable_purge_protection: bool=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + sku: "Sku", + access_policies: Optional[List["AccessPolicyEntry"]] = None, + vault_uri: Optional[str] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_paged_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_paged_models.py deleted file mode 100644 index 59103664335e..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_paged_models.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class VaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`Vault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Vault]'} - } - - def __init__(self, *args, **kwargs): - - super(VaultPaged, self).__init__(*args, **kwargs) -class DeletedVaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedVault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedVault]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedVaultPaged, self).__init__(*args, **kwargs) -class ResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`Resource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Resource]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourcePaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py index 893317da8cec..3d2bb8ce16b1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._vaults_operations import VaultsOperations 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 c85e2340b717..094ee8b310b6 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 @@ -1,102 +1,101 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2016_10_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. - :ivar api_version: Client Api Version. Constant value: "2016-10-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-10-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.OperationListResult" """Lists all of the available Key Vault Rest API operations. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.OperationPaged[~azure.mgmt.keyvault.v2016_10_01.models.Operation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} 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 7aa7cf6d96b8..90441cce4390 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 @@ -1,214 +1,208 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2016_10_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. - :ivar filter: The filter to apply on the operation. Constant value: "resourceType eq 'Microsoft.KeyVault/vaults'". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - - self.config = config + self._config = config def create_or_update( - self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param parameters: Parameters to create or update the vault - :type parameters: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultCreateOrUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update( - self, resource_group_name, vault_name, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultPatchParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param tags: The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultPatchParameters(tags=tags, properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultPatchParameters') # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def delete( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: The name of the vault to delete + :param vault_name: The name of the vault to delete. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" # Construct URL @@ -216,56 +210,51 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def get( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Vault" """Gets the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param vault_name: The name of the vault. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" # Construct URL @@ -273,145 +262,129 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update_access_policy( - self, resource_group_name, vault_name, operation_kind, properties, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] + parameters, # type: "models.VaultAccessPolicyParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param operation_kind: Name of the operation. Possible values include: - 'add', 'replace', 'remove' - :type operation_kind: str or - ~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyUpdateKind - :param properties: Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VaultAccessPolicyParameters or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultAccessPolicyParameters(properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update_access_policy.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'AccessPolicyUpdateKind'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} def list_by_resource_group( - self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription and within the specified resource group. - - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultPaged[~azure.mgmt.keyvault.v2016_10_01.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" def prepare_request(next_link=None): @@ -420,72 +393,67 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} def list_by_subscription( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.VaultPaged[~azure.mgmt.keyvault.v2016_10_01.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" def prepare_request(next_link=None): @@ -493,69 +461,64 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} def list_deleted( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVaultListResult" """Gets information about the deleted vaults in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedVault - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" def prepare_request(next_link=None): @@ -563,71 +526,68 @@ def prepare_request(next_link=None): # Construct URL url = self.list_deleted.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} def get_deleted( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. :type vault_name: str :param location: The location of the deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeletedVault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" # Construct URL @@ -635,262 +595,244 @@ def get_deleted( 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') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedVault', response) + deserialized = self._deserialize('DeletedVault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} - def _purge_deleted_initial( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" # Construct URL - url = self.purge_deleted.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} - def purge_deleted( - self, vault_name, location, custom_headers=None, raw=False, polling=True, **operation_config): - """Permanently deletes the specified vault. aka Purges the deleted Azure - key vault. + def begin_purge_deleted( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. :type vault_name: str :param location: The location of the soft-deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} def list( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Resource - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.ResourcePaged[~azure.mgmt.keyvault.v2016_10_01.models.Resource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = "2015-11-01" + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['$filter'] = self._serialize.query("self.filter", self.filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. - :param name: The vault name. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError """ - vault_name = models.VaultCheckNameAvailabilityParameters(name=name) - + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.check_name_availability.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py index 689af4ca294b..f54ed88d6ad2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py @@ -1,19 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultManagementClientConfiguration from ._key_vault_management_client import KeyVaultManagementClient -__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION - +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py index 71d3bade9787..6c5cb5210b86 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py @@ -1,50 +1,62 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import Any +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. -class KeyVaultManagementClientConfiguration(AzureConfiguration): - """Configuration for KeyVaultManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(KeyVaultManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2018-02-14" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) 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 f3c9b3077f8d..fd8afeb1997a 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 @@ -1,16 +1,15 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import Any, Optional + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations @@ -20,47 +19,59 @@ from . import models -class KeyVaultManagementClient(SDKClient): +class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. - :ivar config: Configuration for client. - :vartype config: KeyVaultManagementClientConfiguration - - :ivar vaults: Vaults operations + :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2018_02_14.operations.VaultsOperations - :ivar private_endpoint_connections: PrivateEndpointConnections operations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.keyvault.v2018_02_14.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResources operations + :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.keyvault.v2018_02_14.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2018_02_14.operations.Operations - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url) - super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-02-14' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) 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 new file mode 100644 index 000000000000..03db2f1496d9 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json @@ -0,0 +1,41 @@ +{ + "chosen_version": "2018-02-14", + "total_api_version_list": ["2018-02-14"], + "client": { + "name": "KeyVaultManagementClient", + "filename": "_key_vault_management_client", + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "has_subscription_id": true + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "package_version": false, + "global_parameters": { + "method": { + "credential": { + "method_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", + "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 + } + }, + "constant": { + } + } + }, + "operation_groups": { + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations" + }, + "operation_mixins": { + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py similarity index 71% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/version.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py index 20ba78005d47..018d48d4060b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py @@ -1,13 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2016-10-01" - +from ._key_vault_management_client_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py new file mode 100644 index 000000000000..7fb48477d0ba --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py @@ -0,0 +1,60 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2018-02-14" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..ce8ac6a6eec8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py @@ -0,0 +1,73 @@ +# 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, Optional + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import PrivateEndpointConnectionsOperations +from .operations_async import PrivateLinkResourcesOperations +from .operations_async import Operations +from .. import models + + +class KeyVaultManagementClient(object): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.Operations + :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. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py new file mode 100644 index 000000000000..4b4b20e273c3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations_async import VaultsOperations +from ._private_endpoint_connections_operations_async import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations_async import PrivateLinkResourcesOperations +from ._operations_async import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..02ba4b52b997 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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.v2018_02_14.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 + + def list( + self, + **kwargs + ) -> "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 + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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': '/providers/Microsoft.KeyVault/operations'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..102f9b9b8f88 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -0,0 +1,280 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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.v2018_02_14.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 get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + request = self._client.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py new file mode 100644 index 000000000000..4f87c4b07ef3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py @@ -0,0 +1,96 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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.v2018_02_14.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 list_by_vault( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self.list_by_vault.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..5d521b0958cb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,863 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations: + """VaultsOperations 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.v2018_02_14.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_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultPatchParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def delete( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> "models.Vault": + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "models.AccessPolicyUpdateKind"], + parameters: "models.VaultAccessPolicyParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_access_policy.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + + def list_deleted( + self, + **kwargs + ) -> "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 + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + + async def get_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> "models.DeletedVault": + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self.get_deleted.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + + async def _purge_deleted_initial( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.post(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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + async def purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + def list( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.ResourceListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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}/resources'} + + async def check_name_availability( + self, + vault_name: "models.VaultCheckNameAvailabilityParameters", + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py index 047f744d15bf..236e5a302a3d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py @@ -1,24 +1,24 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AccessPolicyEntry from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CloudErrorBody from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultListResult from ._models_py3 import DeletedVaultProperties from ._models_py3 import IPRule from ._models_py3 import LogSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Permissions from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection @@ -27,6 +27,7 @@ from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import Resource + from ._models_py3 import ResourceListResult from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import Vault @@ -34,68 +35,74 @@ from ._models_py3 import VaultAccessPolicyProperties from ._models_py3 import VaultCheckNameAvailabilityParameters from ._models_py3 import VaultCreateOrUpdateParameters + from ._models_py3 import VaultListResult from ._models_py3 import VaultPatchParameters from ._models_py3 import VaultPatchProperties from ._models_py3 import VaultProperties from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry - from ._models import CheckNameAvailabilityResult - from ._models import DeletedVault - from ._models import DeletedVaultProperties - from ._models import IPRule - from ._models import LogSpecification - from ._models import NetworkRuleSet - from ._models import Operation - from ._models import OperationDisplay - from ._models import Permissions - from ._models import PrivateEndpoint - from ._models import PrivateEndpointConnection - from ._models import PrivateEndpointConnectionItem - from ._models import PrivateLinkResource - from ._models import PrivateLinkResourceListResult - from ._models import PrivateLinkServiceConnectionState - from ._models import Resource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import Vault - from ._models import VaultAccessPolicyParameters - from ._models import VaultAccessPolicyProperties - from ._models import VaultCheckNameAvailabilityParameters - from ._models import VaultCreateOrUpdateParameters - from ._models import VaultPatchParameters - from ._models import VaultPatchProperties - from ._models import VaultProperties - from ._models import VirtualNetworkRule -from ._paged_models import DeletedVaultPaged -from ._paged_models import OperationPaged -from ._paged_models import ResourcePaged -from ._paged_models import VaultPaged + from ._models import AccessPolicyEntry # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import DeletedVault # type: ignore + from ._models import DeletedVaultListResult # type: ignore + from ._models import DeletedVaultProperties # type: ignore + from ._models import IPRule # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import Permissions # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionItem # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import Vault # type: ignore + from ._models import VaultAccessPolicyParameters # type: ignore + from ._models import VaultAccessPolicyProperties # type: ignore + from ._models import VaultCheckNameAvailabilityParameters # type: ignore + from ._models import VaultCreateOrUpdateParameters # type: ignore + from ._models import VaultListResult # type: ignore + from ._models import VaultPatchParameters # type: ignore + from ._models import VaultPatchProperties # type: ignore + from ._models import VaultProperties # type: ignore + from ._models import VirtualNetworkRule # type: ignore + from ._key_vault_management_client_enums import ( - SkuName, - KeyPermissions, - SecretPermissions, + AccessPolicyUpdateKind, CertificatePermissions, - StoragePermissions, CreateMode, - NetworkRuleBypassOptions, + KeyPermissions, NetworkRuleAction, - PrivateEndpointServiceConnectionStatus, + NetworkRuleBypassOptions, PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, Reason, - AccessPolicyUpdateKind, + SecretPermissions, + SkuName, + StoragePermissions, ) __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', + 'CloudErrorBody', 'DeletedVault', + 'DeletedVaultListResult', 'DeletedVaultProperties', 'IPRule', 'LogSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', + 'OperationListResult', 'Permissions', 'PrivateEndpoint', 'PrivateEndpointConnection', @@ -104,6 +111,7 @@ 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionState', 'Resource', + 'ResourceListResult', 'ServiceSpecification', 'Sku', 'Vault', @@ -111,24 +119,21 @@ 'VaultAccessPolicyProperties', 'VaultCheckNameAvailabilityParameters', 'VaultCreateOrUpdateParameters', + 'VaultListResult', 'VaultPatchParameters', 'VaultPatchProperties', 'VaultProperties', 'VirtualNetworkRule', - 'VaultPaged', - 'DeletedVaultPaged', - 'ResourcePaged', - 'OperationPaged', - 'SkuName', - 'KeyPermissions', - 'SecretPermissions', + 'AccessPolicyUpdateKind', 'CertificatePermissions', - 'StoragePermissions', 'CreateMode', - 'NetworkRuleBypassOptions', + 'KeyPermissions', 'NetworkRuleAction', - 'PrivateEndpointServiceConnectionStatus', + 'NetworkRuleBypassOptions', 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', 'Reason', - 'AccessPolicyUpdateKind', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py index f994b6eca629..36f822d150c2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py @@ -1,23 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from enum import Enum - -class SkuName(str, Enum): - - standard = "standard" - premium = "premium" - - class KeyPermissions(str, Enum): encrypt = "encrypt" @@ -37,7 +27,6 @@ class KeyPermissions(str, Enum): recover = "recover" purge = "purge" - class SecretPermissions(str, Enum): get = "get" @@ -49,7 +38,6 @@ class SecretPermissions(str, Enum): recover = "recover" purge = "purge" - class CertificatePermissions(str, Enum): get = "get" @@ -69,7 +57,6 @@ class CertificatePermissions(str, Enum): backup = "backup" restore = "restore" - class StoragePermissions(str, Enum): get = "get" @@ -87,34 +74,18 @@ class StoragePermissions(str, Enum): getsas = "getsas" deletesas = "deletesas" - -class CreateMode(str, Enum): - - recover = "recover" - default = "default" - - -class NetworkRuleBypassOptions(str, Enum): - - azure_services = "AzureServices" - none = "None" - - -class NetworkRuleAction(str, Enum): - - allow = "Allow" - deny = "Deny" - - class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. + """ pending = "Pending" approved = "Approved" rejected = "Rejected" disconnected = "Disconnected" - class PrivateEndpointConnectionProvisioningState(str, Enum): + """The current provisioning state. + """ succeeded = "Succeeded" creating = "Creating" @@ -123,13 +94,44 @@ class PrivateEndpointConnectionProvisioningState(str, Enum): failed = "Failed" disconnected = "Disconnected" +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + +class NetworkRuleBypassOptions(str, Enum): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + azure_services = "AzureServices" + none = "None" + +class NetworkRuleAction(str, Enum): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. + """ + + allow = "Allow" + deny = "Deny" class Reason(str, Enum): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ account_name_invalid = "AccountNameInvalid" already_exists = "AlreadyExists" - class AccessPolicyUpdateKind(str, Enum): add = "add" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py index bb2afb4d5a2a..92f4f3061a50 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 @@ -1,36 +1,29 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2018_02_14.models.Permissions """ @@ -47,7 +40,10 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.object_id = kwargs.get('object_id', None) @@ -55,22 +51,20 @@ def __init__(self, **kwargs): self.permissions = kwargs.get('permissions', None) -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2018_02_14.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -82,53 +76,27 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from Key Vault resource provider. - :param error: - :type error: ~azure.mgmt.keyvault.v2018_02_14.models.CloudErrorBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) - - -class CloudErrorBody(Model): - """An error response from Key Vault resource provider. - - :param code: Error code. This is a mnemonic that can be consumed - programmatically. + :param code: Error code. This is a mnemonic that can be consumed programmatically. :type code: str - :param message: User friendly error message. The message is typically - localized and may vary with service version. + :param message: User friendly error message. The message is typically localized and may vary + with service version. :type message: str """ @@ -137,17 +105,19 @@ class CloudErrorBody(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -155,9 +125,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties """ _validation = { @@ -173,7 +142,10 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -181,21 +153,43 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -215,7 +209,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -224,15 +221,13 @@ def __init__(self, **kwargs): self.tags = None -class IPRule(Model): - """A rule governing the accessibility of a vault from a specific ip address or - ip range. +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. All required parameters must be populated in order to send to Azure. - :param value: Required. An IPv4 address range in CIDR notation, such as - '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that - start with 124.56.78). + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). :type value: str """ @@ -244,12 +239,15 @@ class IPRule(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IPRule, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -266,31 +264,31 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class NetworkRuleSet(Model): +class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. - :param bypass: Tells what traffic can bypass network rules. This can be - 'AzureServices' or 'None'. If not specified the default is - 'AzureServices'. Possible values include: 'AzureServices', 'None' - :type bypass: str or - ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and - from virtualNetworkRules match. This is only used after the bypass - property has been evaluated. Possible values include: 'Allow', 'Deny' - :type default_action: str or - ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + 'AzureServices', 'None'. + :type bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: 'Allow', 'Deny'. + :type default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] """ _attribute_map = { @@ -300,7 +298,10 @@ class NetworkRuleSet(Model): 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -308,19 +309,17 @@ def __init__(self, **kwargs): self.virtual_network_rules = kwargs.get('virtual_network_rules', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2018_02_14.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification """ _attribute_map = { @@ -330,7 +329,10 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -338,7 +340,7 @@ def __init__(self, **kwargs): self.service_specification = kwargs.get('service_specification', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -358,7 +360,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -366,21 +371,40 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] """ _attribute_map = { @@ -390,7 +414,10 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -398,11 +425,10 @@ def __init__(self, **kwargs): self.storage = kwargs.get('storage', None) -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint object properties. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full identifier of the private endpoint resource. :vartype id: str @@ -416,16 +442,18 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -435,7 +463,7 @@ class Resource(Model): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] """ @@ -455,7 +483,10 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -467,8 +498,7 @@ def __init__(self, **kwargs): class PrivateEndpointConnection(Resource): """Private endpoint connection resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -478,19 +508,16 @@ class PrivateEndpointConnection(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -500,6 +527,7 @@ class PrivateEndpointConnection(Resource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'tags': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -513,48 +541,56 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None -class PrivateEndpointConnectionItem(Model): +class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + Variables are only populated by the server, and will be ignored when sending a request. + :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None class PrivateLinkResource(Resource): """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -564,14 +600,13 @@ class PrivateLinkResource(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :ivar group_id: Group identifier of private link resource. :vartype group_id: str :ivar required_members: Required member names of private link resource. :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private - link resource. + :param required_zone_names: Required DNS zone names of the the private link resource. :type required_zone_names: list[str] """ @@ -596,43 +631,46 @@ class PrivateLinkResource(Resource): 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = kwargs.get('required_zone_names', None) -class PrivateLinkResourceListResult(Model): +class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources - :type value: - list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] """ _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class PrivateLinkServiceConnectionState(Model): - """An object that represents the approval state of the private link - connection. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, - rejected or removed by the key vault owner. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. :type status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service - provider require any updates on the consumer. + :param action_required: A message indicating if changes on the service provider require any + updates on the consumer. :type action_required: str """ @@ -642,43 +680,69 @@ class PrivateLinkServiceConnectionState(Model): 'action_required': {'key': 'actionRequired', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.action_required = kwargs.get('action_required', None) -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ @@ -689,21 +753,23 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class Vault(Model): +class Vault(msrest.serialization.Model): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -715,9 +781,9 @@ class Vault(Model): :vartype type: str :param location: Azure location of the key vault resource. :type location: str - :param tags: Tags assigned to the key vault resource. + :param tags: A set of tags. Tags assigned to the key vault resource. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ @@ -737,7 +803,10 @@ class Vault(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -747,11 +816,10 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -763,9 +831,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties """ _validation = { @@ -784,7 +851,10 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -793,16 +863,14 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] """ _validation = { @@ -813,23 +881,25 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = kwargs.get('access_policies', None) -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -845,22 +915,24 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ @@ -875,21 +947,46 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties """ _attribute_map = { @@ -897,54 +994,49 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. It does not accept false - value. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of - the vault from specific network locations. + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet """ @@ -956,12 +1048,15 @@ class VaultPatchProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -975,60 +1070,51 @@ def __init__(self, **kwargs): self.network_acls = kwargs.get('network_acls', None) -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. It does not accept false - value. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault - from specific network locations. + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. :type network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet - :ivar private_endpoint_connections: List of private endpoint connections - associated with the key vault. + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionItem] """ @@ -1048,13 +1134,16 @@ class VaultProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -1070,14 +1159,14 @@ def __init__(self, **kwargs): self.private_endpoint_connections = None -class VirtualNetworkRule(Model): - """A rule governing the accessibility of a vault from a specific virtual - network. +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- + vnet/subnets/subnet1'. :type id: str """ @@ -1089,6 +1178,9 @@ class VirtualNetworkRule(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = kwargs.get('id', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 7c13a32a59ed..6280744ec48d 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 @@ -1,36 +1,31 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Dict, List, Optional, Union +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. + +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2018_02_14.models.Permissions """ @@ -47,7 +42,15 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "Permissions", + application_id: Optional[str] = None, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -55,22 +58,20 @@ def __init__(self, *, tenant_id: str, object_id: str, permissions, application_i self.permissions = permissions -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2018_02_14.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -82,53 +83,27 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): - """An error response from Key Vault resource provider. - - :param error: - :type error: ~azure.mgmt.keyvault.v2018_02_14.models.CloudErrorBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) - - -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from Key Vault resource provider. - :param code: Error code. This is a mnemonic that can be consumed - programmatically. + :param code: Error code. This is a mnemonic that can be consumed programmatically. :type code: str - :param message: User friendly error message. The message is typically - localized and may vary with service version. + :param message: User friendly error message. The message is typically localized and may vary + with service version. :type message: str """ @@ -137,17 +112,22 @@ class CloudErrorBody(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -155,9 +135,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties """ _validation = { @@ -173,7 +152,12 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeletedVaultProperties"] = None, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -181,21 +165,46 @@ def __init__(self, *, properties=None, **kwargs) -> None: self.properties = properties -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeletedVault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -215,7 +224,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -224,15 +236,13 @@ def __init__(self, **kwargs) -> None: self.tags = None -class IPRule(Model): - """A rule governing the accessibility of a vault from a specific ip address or - ip range. +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. All required parameters must be populated in order to send to Azure. - :param value: Required. An IPv4 address range in CIDR notation, such as - '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that - start with 124.56.78). + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). :type value: str """ @@ -244,12 +254,17 @@ class IPRule(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, value: str, **kwargs) -> None: + def __init__( + self, + *, + value: str, + **kwargs + ): super(IPRule, self).__init__(**kwargs) self.value = value -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -266,31 +281,35 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class NetworkRuleSet(Model): +class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. - :param bypass: Tells what traffic can bypass network rules. This can be - 'AzureServices' or 'None'. If not specified the default is - 'AzureServices'. Possible values include: 'AzureServices', 'None' - :type bypass: str or - ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and - from virtualNetworkRules match. This is only used after the bypass - property has been evaluated. Possible values include: 'Allow', 'Deny' - :type default_action: str or - ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + 'AzureServices', 'None'. + :type bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: 'Allow', 'Deny'. + :type default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] """ _attribute_map = { @@ -300,7 +319,15 @@ class NetworkRuleSet(Model): 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, } - def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_network_rules=None, **kwargs) -> None: + def __init__( + self, + *, + bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "NetworkRuleAction"]] = None, + ip_rules: Optional[List["IPRule"]] = None, + virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + **kwargs + ): super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -308,19 +335,17 @@ def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_n self.virtual_network_rules = virtual_network_rules -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2018_02_14.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification """ _attribute_map = { @@ -330,7 +355,15 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -338,7 +371,7 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, service_sp self.service_specification = service_specification -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -358,7 +391,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -366,21 +407,43 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] """ _attribute_map = { @@ -390,7 +453,15 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, **kwargs) -> None: + def __init__( + self, + *, + keys: Optional[List[Union[str, "KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -398,11 +469,10 @@ def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, self.storage = storage -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint object properties. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full identifier of the private endpoint resource. :vartype id: str @@ -416,16 +486,18 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -435,7 +507,7 @@ class Resource(Model): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] """ @@ -455,7 +527,10 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -467,8 +542,7 @@ def __init__(self, **kwargs) -> None: class PrivateEndpointConnection(Resource): """Private endpoint connection resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -478,19 +552,16 @@ class PrivateEndpointConnection(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -500,6 +571,7 @@ class PrivateEndpointConnection(Resource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'tags': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -513,48 +585,62 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = provisioning_state + self.provisioning_state = None -class PrivateEndpointConnectionItem(Model): +class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + Variables are only populated by the server, and will be ignored when sending a request. + :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = provisioning_state + self.provisioning_state = None class PrivateLinkResource(Resource): """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -564,14 +650,13 @@ class PrivateLinkResource(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :ivar group_id: Group identifier of private link resource. :vartype group_id: str :ivar required_members: Required member names of private link resource. :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private - link resource. + :param required_zone_names: Required DNS zone names of the the private link resource. :type required_zone_names: list[str] """ @@ -596,43 +681,50 @@ class PrivateLinkResource(Resource): 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } - def __init__(self, *, required_zone_names=None, **kwargs) -> None: + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = required_zone_names -class PrivateLinkResourceListResult(Model): +class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources - :type value: - list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] """ _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, *, value=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(Model): - """An object that represents the approval state of the private link - connection. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, - rejected or removed by the key vault owner. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. :type status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service - provider require any updates on the consumer. + :param action_required: A message indicating if changes on the service provider require any + updates on the consumer. :type action_required: str """ @@ -642,43 +734,78 @@ class PrivateLinkServiceConnectionState(Model): 'action_required': {'key': 'actionRequired', 'type': 'str'}, } - def __init__(self, *, status=None, description: str=None, action_required: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + action_required: Optional[str] = None, + **kwargs + ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description self.action_required = action_required -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Resource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, *, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ @@ -689,21 +816,25 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, *, name, **kwargs) -> None: + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name -class Vault(Model): +class Vault(msrest.serialization.Model): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -715,9 +846,9 @@ class Vault(Model): :vartype type: str :param location: Azure location of the key vault resource. :type location: str - :param tags: Tags assigned to the key vault resource. + :param tags: A set of tags. Tags assigned to the key vault resource. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ @@ -737,7 +868,14 @@ class Vault(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, properties, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + properties: "VaultProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -747,11 +885,10 @@ def __init__(self, *, properties, location: str=None, tags=None, **kwargs) -> No self.properties = properties -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -763,9 +900,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties """ _validation = { @@ -784,7 +920,12 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, *, properties, **kwargs) -> None: + def __init__( + self, + *, + properties: "VaultAccessPolicyProperties", + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -793,16 +934,14 @@ def __init__(self, *, properties, **kwargs) -> None: self.properties = properties -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] """ _validation = { @@ -813,23 +952,27 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, *, access_policies, **kwargs) -> None: + def __init__( + self, + *, + access_policies: List["AccessPolicyEntry"], + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -845,22 +988,26 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ @@ -875,21 +1022,53 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags self.properties = properties -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Vault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties """ _attribute_map = { @@ -897,54 +1076,52 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["VaultPatchProperties"] = None, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. It does not accept false - value. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of - the vault from specific network locations. + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet """ @@ -956,12 +1133,26 @@ class VaultPatchProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, } - def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: Optional[str] = None, + sku: Optional["Sku"] = None, + access_policies: Optional[List["AccessPolicyEntry"]] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -975,60 +1166,51 @@ def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabl self.network_acls = network_acls -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :type access_policies: - list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys - and secrets. + :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. It does not accept false - value. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault - from specific network locations. + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. :type network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet - :ivar private_endpoint_connections: List of private endpoint connections - associated with the key vault. + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionItem] """ @@ -1048,13 +1230,28 @@ class VaultProperties(Model): 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } - def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + sku: "Sku", + access_policies: Optional[List["AccessPolicyEntry"]] = None, + vault_uri: Optional[str] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1070,14 +1267,14 @@ def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str= self.private_endpoint_connections = None -class VirtualNetworkRule(Model): - """A rule governing the accessibility of a vault from a specific virtual - network. +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- + vnet/subnets/subnet1'. :type id: str """ @@ -1089,6 +1286,11 @@ class VirtualNetworkRule(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: str, **kwargs) -> None: + def __init__( + self, + *, + id: str, + **kwargs + ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_paged_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_paged_models.py deleted file mode 100644 index fe6c28e24f5f..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_paged_models.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class VaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`Vault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Vault]'} - } - - def __init__(self, *args, **kwargs): - - super(VaultPaged, self).__init__(*args, **kwargs) -class DeletedVaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedVault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedVault]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedVaultPaged, self).__init__(*args, **kwargs) -class ResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`Resource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Resource]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourcePaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py index 70f7bdab83d8..ad4413dd4cae 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py @@ -1,12 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._vaults_operations import VaultsOperations 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 e6046ef33a15..eab5bb884192 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 @@ -1,102 +1,101 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2018_02_14.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. - :ivar api_version: Client Api Version. Constant value: "2018-02-14". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-14" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.OperationListResult" """Lists all of the available Key Vault Rest API operations. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.OperationPaged[~azure.mgmt.keyvault.v2018_02_14.models.Operation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} 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 12d48db45692..dca98975a92a 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 @@ -1,303 +1,284 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2018_02_14.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. - :ivar api_version: Client Api Version. Constant value: "2018-02-14". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-14" - - self.config = config + self._config = config def get( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): - """Gets the specified private endpoint connection associated with the key - vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # 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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} def put( - self, resource_group_name, vault_name, private_endpoint_connection_name, properties, custom_headers=None, raw=False, **operation_config): - """Updates the specified private endpoint connection associated with the - key vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # 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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str :param properties: The intended state of private endpoint connection. - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL url = self.put.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) - header_dict = { - 'Retry-After': 'int', - 'Azure-AsyncOperation': 'str', - } + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, response_headers) return deserialized put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} - def _delete_initial( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} deserialized = None - header_dict = {} - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) - header_dict = { - 'Retry-After': 'int', - 'Location': 'str', - } + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) - def delete( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes the specified private endpoint connection associated with the - key vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def begin_delete( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - PrivateEndpointConnection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] raw_result = self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - header_dict = { - 'Retry-After': 'int', - 'Location': 'str', - } - deserialized = self._deserialize('PrivateEndpointConnection', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/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 13de4a1b2b7a..801b3323c22c 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 @@ -1,104 +1,97 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2018_02_14.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. - :ivar api_version: Client Api Version. Constant value: "2018-02-14". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-02-14" - - self.config = config + self._config = config def list_by_vault( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # 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. + :param resource_group_name: Name of the resource group that contains the key vault. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateLinkResourceListResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + # Construct URL url = self.list_by_vault.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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}$') + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateLinkResourceListResult', response) + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 01c3fcfd1053..458c4adbd67b 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 @@ -1,247 +1,247 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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.v2018_02_14.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. - :ivar filter: The filter to apply on the operation. Constant value: "resourceType eq 'Microsoft.KeyVault/vaults'". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - - self.config = config - + self._config = config def _create_or_update_initial( - self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def begin_create_or_update( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param parameters: Parameters to create or update the vault - :type parameters: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param parameters: Parameters to create or update the vault. + :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 polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Vault or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2018_02_14.models.Vault]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - deserialized = self._deserialize('Vault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update( - self, resource_group_name, vault_name, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultPatchParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param tags: The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultPatchParameters(tags=tags, properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultPatchParameters') # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def delete( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: The name of the vault to delete + :param vault_name: The name of the vault to delete. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" # Construct URL @@ -249,56 +249,51 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def get( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Vault" """Gets the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param vault_name: The name of the vault. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" # Construct URL @@ -306,145 +301,129 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update_access_policy( - self, resource_group_name, vault_name, operation_kind, properties, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] + parameters, # type: "models.VaultAccessPolicyParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param operation_kind: Name of the operation. Possible values include: - 'add', 'replace', 'remove' - :type operation_kind: str or - ~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyUpdateKind - :param properties: Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VaultAccessPolicyParameters or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultAccessPolicyParameters(properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update_access_policy.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'AccessPolicyUpdateKind'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} def list_by_resource_group( - self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription and within the specified resource group. - - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultPaged[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" def prepare_request(next_link=None): @@ -453,72 +432,67 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} def list_by_subscription( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.VaultPaged[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" def prepare_request(next_link=None): @@ -526,69 +500,64 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} def list_deleted( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVaultListResult" """Gets information about the deleted vaults in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedVault - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" def prepare_request(next_link=None): @@ -596,71 +565,68 @@ def prepare_request(next_link=None): # Construct URL url = self.list_deleted.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} def get_deleted( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. :type vault_name: str :param location: The location of the deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeletedVault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" # Construct URL @@ -668,262 +634,244 @@ def get_deleted( 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') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedVault', response) + deserialized = self._deserialize('DeletedVault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} - def _purge_deleted_initial( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" # Construct URL - url = self.purge_deleted.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} - def purge_deleted( - self, vault_name, location, custom_headers=None, raw=False, polling=True, **operation_config): - """Permanently deletes the specified vault. aka Purges the deleted Azure - key vault. + def begin_purge_deleted( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. :type vault_name: str :param location: The location of the soft-deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} def list( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Resource - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.ResourcePaged[~azure.mgmt.keyvault.v2018_02_14.models.Resource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = "2015-11-01" + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['$filter'] = self._serialize.query("self.filter", self.filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. - :param name: The vault name. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError """ - vault_name = models.VaultCheckNameAvailabilityParameters(name=name) - + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.check_name_availability.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py index 689af4ca294b..f54ed88d6ad2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py @@ -1,19 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultManagementClientConfiguration from ._key_vault_management_client import KeyVaultManagementClient -__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration'] - -from .version import VERSION - -__version__ = VERSION - +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py index 71d3bade9787..3360b32c73ad 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py @@ -1,50 +1,62 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrestazure import AzureConfiguration -from .version import VERSION +from typing import Any +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. -class KeyVaultManagementClientConfiguration(AzureConfiguration): - """Configuration for KeyVaultManagementClient Note that all parameters used to create this instance are saved as instance attributes. - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str - :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - if not base_url: - base_url = 'https://management.azure.com' - - super(KeyVaultManagementClientConfiguration, self).__init__(base_url) - - # Starting Autorest.Python 4.0.64, make connection pool activated by default - self.keep_alive = True - - self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION)) - self.add_user_agent('Azure-SDK-For-Python') + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) - self.credentials = credentials + self.credential = credential self.subscription_id = subscription_id + self.api_version = "2019-09-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index b01b85c04d61..0041afc8cd10 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 @@ -1,16 +1,15 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import SDKClient -from msrest import Serializer, Deserializer +from typing import Any, Optional + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations @@ -20,47 +19,59 @@ from . import models -class KeyVaultManagementClient(SDKClient): +class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. - :ivar config: Configuration for client. - :vartype config: KeyVaultManagementClientConfiguration - - :ivar vaults: Vaults operations + :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2019_09_01.operations.VaultsOperations - :ivar private_endpoint_connections: PrivateEndpointConnections operations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.keyvault.v2019_09_01.operations.PrivateEndpointConnectionsOperations - :ivar private_link_resources: PrivateLinkResources operations + :ivar private_link_resources: PrivateLinkResourcesOperations operations :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 - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` - :param subscription_id: Subscription credentials which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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. :type subscription_id: str :param str base_url: Service URL """ def __init__( - self, credentials, subscription_id, base_url=None): - - self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url) - super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config) + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2019-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( - self._client, self.config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) 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 new file mode 100644 index 000000000000..d42666b92413 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json @@ -0,0 +1,41 @@ +{ + "chosen_version": "2019-09-01", + "total_api_version_list": ["2019-09-01"], + "client": { + "name": "KeyVaultManagementClient", + "filename": "_key_vault_management_client", + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "has_subscription_id": true + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "package_version": false, + "global_parameters": { + "method": { + "credential": { + "method_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", + "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 + } + }, + "constant": { + } + } + }, + "operation_groups": { + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations" + }, + "operation_mixins": { + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py similarity index 71% rename from sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/version.py rename to sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py index 1a46faeb7ce7..018d48d4060b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py @@ -1,13 +1,10 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.2.0" - +from ._key_vault_management_client_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py new file mode 100644 index 000000000000..8fdd52022b94 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py @@ -0,0 +1,60 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2019-09-01" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..864b69abe5a6 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py @@ -0,0 +1,73 @@ +# 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, Optional + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import PrivateEndpointConnectionsOperations +from .operations_async import PrivateLinkResourcesOperations +from .operations_async import Operations +from .. import models + + +class KeyVaultManagementClient(object): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.Operations + :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. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..4b4b20e273c3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations_async import VaultsOperations +from ._private_endpoint_connections_operations_async import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations_async import PrivateLinkResourcesOperations +from ._operations_async import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..5248f4e61907 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations 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 + + def list( + self, + **kwargs + ) -> "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 + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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': '/providers/Microsoft.KeyVault/operations'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..134b81c4847a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -0,0 +1,280 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations 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 get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "models.PrivateEndpointConnection", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.put.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self._delete_initial.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + request = self._client.delete(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, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + async def delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py new file mode 100644 index 000000000000..172fd9e9155b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py @@ -0,0 +1,96 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations 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 list_by_vault( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self.list_by_vault.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..d94d26bce836 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,863 @@ +# 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, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations: + """VaultsOperations 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_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultPatchParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def delete( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.delete(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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs + ) -> "models.Vault": + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "models.AccessPolicyUpdateKind"], + parameters: "models.VaultAccessPolicyParameters", + **kwargs + ) -> "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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_access_policy.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.VaultListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + + def list_deleted( + self, + **kwargs + ) -> "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 + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + + async def get_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> "models.DeletedVault": + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self.get_deleted.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + 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('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + + async def _purge_deleted_initial( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + request = self._client.post(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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + async def purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> None: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + + def list( + self, + top: Optional[int] = None, + **kwargs + ) -> "models.ResourceListResult": + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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}/resources'} + + async def check_name_availability( + self, + vault_name: "models.VaultCheckNameAvailabilityParameters", + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # 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'] = 'application/json' + + # Construct and send request + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index 047f744d15bf..236e5a302a3d 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 @@ -1,24 +1,24 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- try: from ._models_py3 import AccessPolicyEntry from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CloudErrorBody from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultListResult from ._models_py3 import DeletedVaultProperties from ._models_py3 import IPRule from ._models_py3 import LogSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult from ._models_py3 import Permissions from ._models_py3 import PrivateEndpoint from ._models_py3 import PrivateEndpointConnection @@ -27,6 +27,7 @@ from ._models_py3 import PrivateLinkResourceListResult from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import Resource + from ._models_py3 import ResourceListResult from ._models_py3 import ServiceSpecification from ._models_py3 import Sku from ._models_py3 import Vault @@ -34,68 +35,74 @@ from ._models_py3 import VaultAccessPolicyProperties from ._models_py3 import VaultCheckNameAvailabilityParameters from ._models_py3 import VaultCreateOrUpdateParameters + from ._models_py3 import VaultListResult from ._models_py3 import VaultPatchParameters from ._models_py3 import VaultPatchProperties from ._models_py3 import VaultProperties from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry - from ._models import CheckNameAvailabilityResult - from ._models import DeletedVault - from ._models import DeletedVaultProperties - from ._models import IPRule - from ._models import LogSpecification - from ._models import NetworkRuleSet - from ._models import Operation - from ._models import OperationDisplay - from ._models import Permissions - from ._models import PrivateEndpoint - from ._models import PrivateEndpointConnection - from ._models import PrivateEndpointConnectionItem - from ._models import PrivateLinkResource - from ._models import PrivateLinkResourceListResult - from ._models import PrivateLinkServiceConnectionState - from ._models import Resource - from ._models import ServiceSpecification - from ._models import Sku - from ._models import Vault - from ._models import VaultAccessPolicyParameters - from ._models import VaultAccessPolicyProperties - from ._models import VaultCheckNameAvailabilityParameters - from ._models import VaultCreateOrUpdateParameters - from ._models import VaultPatchParameters - from ._models import VaultPatchProperties - from ._models import VaultProperties - from ._models import VirtualNetworkRule -from ._paged_models import DeletedVaultPaged -from ._paged_models import OperationPaged -from ._paged_models import ResourcePaged -from ._paged_models import VaultPaged + from ._models import AccessPolicyEntry # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import DeletedVault # type: ignore + from ._models import DeletedVaultListResult # type: ignore + from ._models import DeletedVaultProperties # type: ignore + from ._models import IPRule # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import Permissions # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionItem # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import Vault # type: ignore + from ._models import VaultAccessPolicyParameters # type: ignore + from ._models import VaultAccessPolicyProperties # type: ignore + from ._models import VaultCheckNameAvailabilityParameters # type: ignore + from ._models import VaultCreateOrUpdateParameters # type: ignore + from ._models import VaultListResult # type: ignore + from ._models import VaultPatchParameters # type: ignore + from ._models import VaultPatchProperties # type: ignore + from ._models import VaultProperties # type: ignore + from ._models import VirtualNetworkRule # type: ignore + from ._key_vault_management_client_enums import ( - SkuName, - KeyPermissions, - SecretPermissions, + AccessPolicyUpdateKind, CertificatePermissions, - StoragePermissions, CreateMode, - NetworkRuleBypassOptions, + KeyPermissions, NetworkRuleAction, - PrivateEndpointServiceConnectionStatus, + NetworkRuleBypassOptions, PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, Reason, - AccessPolicyUpdateKind, + SecretPermissions, + SkuName, + StoragePermissions, ) __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', + 'CloudErrorBody', 'DeletedVault', + 'DeletedVaultListResult', 'DeletedVaultProperties', 'IPRule', 'LogSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', + 'OperationListResult', 'Permissions', 'PrivateEndpoint', 'PrivateEndpointConnection', @@ -104,6 +111,7 @@ 'PrivateLinkResourceListResult', 'PrivateLinkServiceConnectionState', 'Resource', + 'ResourceListResult', 'ServiceSpecification', 'Sku', 'Vault', @@ -111,24 +119,21 @@ 'VaultAccessPolicyProperties', 'VaultCheckNameAvailabilityParameters', 'VaultCreateOrUpdateParameters', + 'VaultListResult', 'VaultPatchParameters', 'VaultPatchProperties', 'VaultProperties', 'VirtualNetworkRule', - 'VaultPaged', - 'DeletedVaultPaged', - 'ResourcePaged', - 'OperationPaged', - 'SkuName', - 'KeyPermissions', - 'SecretPermissions', + 'AccessPolicyUpdateKind', 'CertificatePermissions', - 'StoragePermissions', 'CreateMode', - 'NetworkRuleBypassOptions', + 'KeyPermissions', 'NetworkRuleAction', - 'PrivateEndpointServiceConnectionStatus', + 'NetworkRuleBypassOptions', 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', 'Reason', - 'AccessPolicyUpdateKind', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index f994b6eca629..36f822d150c2 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 @@ -1,23 +1,13 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from enum import Enum - -class SkuName(str, Enum): - - standard = "standard" - premium = "premium" - - class KeyPermissions(str, Enum): encrypt = "encrypt" @@ -37,7 +27,6 @@ class KeyPermissions(str, Enum): recover = "recover" purge = "purge" - class SecretPermissions(str, Enum): get = "get" @@ -49,7 +38,6 @@ class SecretPermissions(str, Enum): recover = "recover" purge = "purge" - class CertificatePermissions(str, Enum): get = "get" @@ -69,7 +57,6 @@ class CertificatePermissions(str, Enum): backup = "backup" restore = "restore" - class StoragePermissions(str, Enum): get = "get" @@ -87,34 +74,18 @@ class StoragePermissions(str, Enum): getsas = "getsas" deletesas = "deletesas" - -class CreateMode(str, Enum): - - recover = "recover" - default = "default" - - -class NetworkRuleBypassOptions(str, Enum): - - azure_services = "AzureServices" - none = "None" - - -class NetworkRuleAction(str, Enum): - - allow = "Allow" - deny = "Deny" - - class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. + """ pending = "Pending" approved = "Approved" rejected = "Rejected" disconnected = "Disconnected" - class PrivateEndpointConnectionProvisioningState(str, Enum): + """The current provisioning state. + """ succeeded = "Succeeded" creating = "Creating" @@ -123,13 +94,44 @@ class PrivateEndpointConnectionProvisioningState(str, Enum): failed = "Failed" disconnected = "Disconnected" +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + +class NetworkRuleBypassOptions(str, Enum): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + azure_services = "AzureServices" + none = "None" + +class NetworkRuleAction(str, Enum): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. + """ + + allow = "Allow" + deny = "Deny" class Reason(str, Enum): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ account_name_invalid = "AccountNameInvalid" already_exists = "AlreadyExists" - class AccessPolicyUpdateKind(str, Enum): add = "add" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py index 32b541cd9bd1..d0b0e54a7b1a 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 @@ -1,36 +1,29 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2019_09_01.models.Permissions """ @@ -47,7 +40,10 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.object_id = kwargs.get('object_id', None) @@ -55,22 +51,20 @@ def __init__(self, **kwargs): self.permissions = kwargs.get('permissions', None) -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2019_09_01.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -82,53 +76,27 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from Key Vault resource provider. - :param error: - :type error: ~azure.mgmt.keyvault.v2019_09_01.models.CloudErrorBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, **kwargs): - super(CloudError, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) - - -class CloudErrorBody(Model): - """An error response from Key Vault resource provider. - - :param code: Error code. This is a mnemonic that can be consumed - programmatically. + :param code: Error code. This is a mnemonic that can be consumed programmatically. :type code: str - :param message: User friendly error message. The message is typically - localized and may vary with service version. + :param message: User friendly error message. The message is typically localized and may vary + with service version. :type message: str """ @@ -137,17 +105,19 @@ class CloudErrorBody(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = kwargs.get('code', None) self.message = kwargs.get('message', None) -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -155,9 +125,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties """ _validation = { @@ -173,7 +142,10 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -181,21 +153,43 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -215,7 +209,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -224,15 +221,13 @@ def __init__(self, **kwargs): self.tags = None -class IPRule(Model): - """A rule governing the accessibility of a vault from a specific ip address or - ip range. +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. All required parameters must be populated in order to send to Azure. - :param value: Required. An IPv4 address range in CIDR notation, such as - '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that - start with 124.56.78). + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). :type value: str """ @@ -244,12 +239,15 @@ class IPRule(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IPRule, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -266,31 +264,31 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) self.blob_duration = kwargs.get('blob_duration', None) -class NetworkRuleSet(Model): +class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. - :param bypass: Tells what traffic can bypass network rules. This can be - 'AzureServices' or 'None'. If not specified the default is - 'AzureServices'. Possible values include: 'AzureServices', 'None' - :type bypass: str or - ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and - from virtualNetworkRules match. This is only used after the bypass - property has been evaluated. Possible values include: 'Allow', 'Deny' - :type default_action: str or - ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + 'AzureServices', 'None'. + :type bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: 'Allow', 'Deny'. + :type default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] """ _attribute_map = { @@ -300,7 +298,10 @@ class NetworkRuleSet(Model): 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -308,19 +309,17 @@ def __init__(self, **kwargs): self.virtual_network_rules = kwargs.get('virtual_network_rules', None) -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ _attribute_map = { @@ -330,7 +329,10 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -338,7 +340,7 @@ def __init__(self, **kwargs): self.service_specification = kwargs.get('service_specification', None) -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -358,7 +360,10 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -366,21 +371,40 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', None) -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] """ _attribute_map = { @@ -390,7 +414,10 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -398,11 +425,10 @@ def __init__(self, **kwargs): self.storage = kwargs.get('storage', None) -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint object properties. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full identifier of the private endpoint resource. :vartype id: str @@ -416,16 +442,18 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -435,7 +463,7 @@ class Resource(Model): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] """ @@ -455,7 +483,10 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -467,8 +498,7 @@ def __init__(self, **kwargs): class PrivateEndpointConnection(Resource): """Private endpoint connection resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -478,19 +508,16 @@ class PrivateEndpointConnection(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -500,6 +527,7 @@ class PrivateEndpointConnection(Resource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'tags': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -513,48 +541,56 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None -class PrivateEndpointConnectionItem(Model): +class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + Variables are only populated by the server, and will be ignored when sending a request. + :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. + :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) + self.provisioning_state = None class PrivateLinkResource(Resource): """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -564,14 +600,13 @@ class PrivateLinkResource(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :ivar group_id: Group identifier of private link resource. :vartype group_id: str :ivar required_members: Required member names of private link resource. :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private - link resource. + :param required_zone_names: Required DNS zone names of the the private link resource. :type required_zone_names: list[str] """ @@ -596,43 +631,46 @@ class PrivateLinkResource(Resource): 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = kwargs.get('required_zone_names', None) -class PrivateLinkResourceListResult(Model): +class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources - :type value: - list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] """ _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = kwargs.get('value', None) -class PrivateLinkServiceConnectionState(Model): - """An object that represents the approval state of the private link - connection. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, - rejected or removed by the key vault owner. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. :type status: str or ~azure.mgmt.keyvault.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 updates on the consumer. + :param action_required: A message indicating if changes on the service provider require any + updates on the consumer. :type action_required: str """ @@ -642,43 +680,69 @@ class PrivateLinkServiceConnectionState(Model): 'action_required': {'key': 'actionRequired', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) self.action_required = kwargs.get('action_required', None) -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = kwargs.get('log_specifications', None) -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ @@ -689,21 +753,23 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class Vault(Model): +class Vault(msrest.serialization.Model): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -715,9 +781,9 @@ class Vault(Model): :vartype type: str :param location: Azure location of the key vault resource. :type location: str - :param tags: Tags assigned to the key vault resource. + :param tags: A set of tags. Tags assigned to the key vault resource. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ @@ -737,7 +803,10 @@ class Vault(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -747,11 +816,10 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -763,9 +831,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties """ _validation = { @@ -784,7 +851,10 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -793,16 +863,14 @@ def __init__(self, **kwargs): self.properties = kwargs.get('properties', None) -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] """ _validation = { @@ -813,23 +881,25 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = kwargs.get('access_policies', None) -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -845,22 +915,24 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs.get('name', None) -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ @@ -875,21 +947,46 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties """ _attribute_map = { @@ -897,66 +994,58 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. Once set to true, it cannot - be reverted to false. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. :type enable_soft_delete: bool - :param enable_rbac_authorization: Property that controls how data actions - are authorized. When true, the key vault will use Role Based Access - Control (RBAC) for authorization of data actions, and the access policies - specified in vault properties will be ignored (warning: this is a preview - feature). When false, the key vault will use the access policies specified - in vault properties, and any policy stored on Azure Resource Manager will - be ignored. If null or not specified, the value of this property will not - change. + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the value of this property will not change. :type enable_rbac_authorization: bool - :param soft_delete_retention_in_days: softDelete data retention days. It - accepts >=7 and <=90. + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of - the vault from specific network locations. + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet """ @@ -970,12 +1059,15 @@ class VaultPatchProperties(Model): 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -991,75 +1083,62 @@ def __init__(self, **kwargs): self.network_acls = kwargs.get('network_acls', None) -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :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 access_policies: An array of 0 to 1024 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. If it's not set to any - value(true or false) when creating new key vault, it will be set to true - by default. Once set to true, it cannot be reverted to false. Default - value: True . + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It - accepts >=7 and <=90. Default value: 90 . + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int - :param enable_rbac_authorization: Property that controls how data actions - are authorized. When true, the key vault will use Role Based Access - Control (RBAC) for authorization of data actions, and the access policies - specified in vault properties will be ignored (warning: this is a preview - feature). When false, the key vault will use the access policies specified - in vault properties, and any policy stored on Azure Resource Manager will - be ignored. If null or not specified, the vault is created with the - default value of false. Note that management actions are always authorized - with RBAC. Default value: False . + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the vault is created with the default value of false. Note that management + actions are always authorized with RBAC. :type enable_rbac_authorization: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault - from specific network locations. + :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 - :ivar private_endpoint_connections: List of private endpoint connections - associated with the key vault. + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionItem] """ @@ -1081,13 +1160,16 @@ class VaultProperties(Model): 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -1105,14 +1187,14 @@ def __init__(self, **kwargs): self.private_endpoint_connections = None -class VirtualNetworkRule(Model): - """A rule governing the accessibility of a vault from a specific virtual - network. +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- + vnet/subnets/subnet1'. :type id: str """ @@ -1124,6 +1206,9 @@ class VirtualNetworkRule(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = kwargs.get('id', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index 7c0dcb3c6fd4..ac0939307869 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 @@ -1,36 +1,31 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model -from msrest.exceptions import HttpOperationError +from typing import Dict, List, Optional, Union +import msrest.serialization -class AccessPolicyEntry(Model): - """An identity that have access to the key vault. All identities in the array - must use the same tenant ID as the key vault's tenant ID. + +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or - security group in the Azure Active Directory tenant for the vault. The - object ID must be unique for the list of access policies. + :param object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. :type object_id: str - :param application_id: Application ID of the client making request on - behalf of a principal + :param application_id: Application ID of the client making request on behalf of a principal. :type application_id: str - :param permissions: Required. Permissions the identity has for keys, - secrets and certificates. + :param permissions: Required. Permissions the identity has for keys, secrets and certificates. :type permissions: ~azure.mgmt.keyvault.v2019_09_01.models.Permissions """ @@ -47,7 +42,15 @@ class AccessPolicyEntry(Model): 'permissions': {'key': 'permissions', 'type': 'Permissions'}, } - def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "Permissions", + application_id: Optional[str] = None, + **kwargs + ): super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -55,22 +58,20 @@ def __init__(self, *, tenant_id: str, object_id: str, permissions, application_i self.permissions = permissions -class CheckNameAvailabilityResult(Model): +class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar name_available: A boolean value that indicates whether the name is - available for you to use. If true, the name is available. If false, the - name has already been taken or is invalid and cannot be used. + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason - element is only returned if NameAvailable is false. Possible values - include: 'AccountNameInvalid', 'AlreadyExists' + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', + 'AlreadyExists'. :vartype reason: str or ~azure.mgmt.keyvault.v2019_09_01.models.Reason - :ivar message: An error message explaining the Reason value in more - detail. + :ivar message: An error message explaining the Reason value in more detail. :vartype message: str """ @@ -82,53 +83,27 @@ class CheckNameAvailabilityResult(Model): _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'Reason'}, + 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None self.message = None -class CloudError(Model): - """An error response from Key Vault resource provider. - - :param error: - :type error: ~azure.mgmt.keyvault.v2019_09_01.models.CloudErrorBody - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CloudErrorBody'}, - } - - def __init__(self, *, error=None, **kwargs) -> None: - super(CloudError, self).__init__(**kwargs) - self.error = error - - -class CloudErrorException(HttpOperationError): - """Server responsed with exception of type: 'CloudError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, deserialize, response, *args): - - super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) - - -class CloudErrorBody(Model): +class CloudErrorBody(msrest.serialization.Model): """An error response from Key Vault resource provider. - :param code: Error code. This is a mnemonic that can be consumed - programmatically. + :param code: Error code. This is a mnemonic that can be consumed programmatically. :type code: str - :param message: User friendly error message. The message is typically - localized and may vary with service version. + :param message: User friendly error message. The message is typically localized and may vary + with service version. :type message: str """ @@ -137,17 +112,22 @@ class CloudErrorBody(Model): 'message': {'key': 'message', 'type': 'str'}, } - def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message -class DeletedVault(Model): +class DeletedVault(msrest.serialization.Model): """Deleted vault information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: The resource ID for the deleted key vault. :vartype id: str @@ -155,9 +135,8 @@ class DeletedVault(Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties """ _validation = { @@ -173,7 +152,12 @@ class DeletedVault(Model): 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, } - def __init__(self, *, properties=None, **kwargs) -> None: + def __init__( + self, + *, + properties: Optional["DeletedVaultProperties"] = None, + **kwargs + ): super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -181,21 +165,46 @@ def __init__(self, *, properties=None, **kwargs) -> None: self.properties = properties -class DeletedVaultProperties(Model): +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeletedVault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedVaultProperties(msrest.serialization.Model): """Properties of the deleted vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar vault_id: The resource id of the original vault. :vartype vault_id: str :ivar location: The location of the original vault. :vartype location: str :ivar deletion_date: The deleted date. - :vartype deletion_date: datetime + :vartype deletion_date: ~datetime.datetime :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: datetime - :ivar tags: Tags of the original vault. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. :vartype tags: dict[str, str] """ @@ -215,7 +224,10 @@ class DeletedVaultProperties(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -224,15 +236,13 @@ def __init__(self, **kwargs) -> None: self.tags = None -class IPRule(Model): - """A rule governing the accessibility of a vault from a specific ip address or - ip range. +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. All required parameters must be populated in order to send to Azure. - :param value: Required. An IPv4 address range in CIDR notation, such as - '124.56.78.91' (simple IP address) or '124.56.78.0/24' (all addresses that - start with 124.56.78). + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). :type value: str """ @@ -244,12 +254,17 @@ class IPRule(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, *, value: str, **kwargs) -> None: + def __init__( + self, + *, + value: str, + **kwargs + ): super(IPRule, self).__init__(**kwargs) self.value = value -class LogSpecification(Model): +class LogSpecification(msrest.serialization.Model): """Log specification of operation. :param name: Name of log specification. @@ -266,31 +281,35 @@ class LogSpecification(Model): 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, } - def __init__(self, *, name: str=None, display_name: str=None, blob_duration: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration -class NetworkRuleSet(Model): +class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. - :param bypass: Tells what traffic can bypass network rules. This can be - 'AzureServices' or 'None'. If not specified the default is - 'AzureServices'. Possible values include: 'AzureServices', 'None' - :type bypass: str or - ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and - from virtualNetworkRules match. This is only used after the bypass - property has been evaluated. Possible values include: 'Allow', 'Deny' - :type default_action: str or - ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + 'AzureServices', 'None'. + :type bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: 'Allow', 'Deny'. + :type default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] """ _attribute_map = { @@ -300,7 +319,15 @@ class NetworkRuleSet(Model): 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, } - def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_network_rules=None, **kwargs) -> None: + def __init__( + self, + *, + bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "NetworkRuleAction"]] = None, + ip_rules: Optional[List["IPRule"]] = None, + virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + **kwargs + ): super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -308,19 +335,17 @@ def __init__(self, *, bypass=None, default_action=None, ip_rules=None, virtual_n self.virtual_network_rules = virtual_network_rules -class Operation(Model): +class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation} + :param name: Operation name: {provider}/{resource}/{operation}. :type name: str :param display: Display metadata associated with the operation. :type display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay :param origin: The origin of operations. :type origin: str - :param service_specification: One property of operation, include metric - specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ _attribute_map = { @@ -330,7 +355,15 @@ class Operation(Model): 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, } - def __init__(self, *, name: str=None, display=None, origin: str=None, service_specification=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -338,7 +371,7 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, service_sp self.service_specification = service_specification -class OperationDisplay(Model): +class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. :param provider: Service provider: Microsoft Key Vault. @@ -358,7 +391,15 @@ class OperationDisplay(Model): 'description': {'key': 'description', 'type': 'str'}, } - def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -366,21 +407,43 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description -class Permissions(Model): +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys - :type keys: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] - :param secrets: Permissions to secrets - :type secrets: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] - :param certificates: Permissions to certificates - :type certificates: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] - :param storage: Permissions to storage accounts - :type storage: list[str or - ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] """ _attribute_map = { @@ -390,7 +453,15 @@ class Permissions(Model): 'storage': {'key': 'storage', 'type': '[str]'}, } - def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, **kwargs) -> None: + def __init__( + self, + *, + keys: Optional[List[Union[str, "KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + **kwargs + ): super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -398,11 +469,10 @@ def __init__(self, *, keys=None, secrets=None, certificates=None, storage=None, self.storage = storage -class PrivateEndpoint(Model): +class PrivateEndpoint(msrest.serialization.Model): """Private endpoint object properties. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Full identifier of the private endpoint resource. :vartype id: str @@ -416,16 +486,18 @@ class PrivateEndpoint(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PrivateEndpoint, self).__init__(**kwargs) self.id = None -class Resource(Model): +class Resource(msrest.serialization.Model): """Key Vault resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -435,7 +507,7 @@ class Resource(Model): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] """ @@ -455,7 +527,10 @@ class Resource(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -467,8 +542,7 @@ def __init__(self, **kwargs) -> None: class PrivateEndpointConnection(Resource): """Private endpoint connection resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -478,19 +552,16 @@ class PrivateEndpointConnection(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the - private link connection. + :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -500,6 +571,7 @@ class PrivateEndpointConnection(Resource): 'type': {'readonly': True}, 'location': {'readonly': True}, 'tags': {'readonly': True}, + 'provisioning_state': {'readonly': True}, } _attribute_map = { @@ -513,48 +585,62 @@ class PrivateEndpointConnection(Resource): 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = provisioning_state + self.provisioning_state = None -class PrivateEndpointConnectionItem(Model): +class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + Variables are only populated by the server, and will be ignored when sending a request. + :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. + :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint - connection. Possible values include: 'Succeeded', 'Creating', 'Updating', - 'Deleting', 'Failed', 'Disconnected' - :type provisioning_state: str or + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ + _validation = { + 'provisioning_state': {'readonly': True}, + } + _attribute_map = { 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } - def __init__(self, *, private_endpoint=None, private_link_service_connection_state=None, provisioning_state=None, **kwargs) -> None: + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = provisioning_state + self.provisioning_state = None class PrivateLinkResource(Resource): """A private link resource. - Variables are only populated by the server, and will be ignored when - sending a request. + 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 @@ -564,14 +650,13 @@ class PrivateLinkResource(Resource): :vartype type: str :ivar location: Azure location of the key vault resource. :vartype location: str - :ivar tags: Tags assigned to the key vault resource. + :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] :ivar group_id: Group identifier of private link resource. :vartype group_id: str :ivar required_members: Required member names of private link resource. :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private - link resource. + :param required_zone_names: Required DNS zone names of the the private link resource. :type required_zone_names: list[str] """ @@ -596,43 +681,50 @@ class PrivateLinkResource(Resource): 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, } - def __init__(self, *, required_zone_names=None, **kwargs) -> None: + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None self.required_zone_names = required_zone_names -class PrivateLinkResourceListResult(Model): +class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources - :type value: - list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] """ _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } - def __init__(self, *, value=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value -class PrivateLinkServiceConnectionState(Model): - """An object that represents the approval state of the private link - connection. +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, - rejected or removed by the key vault owner. Possible values include: - 'Pending', 'Approved', 'Rejected', 'Disconnected' + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. :type status: str or ~azure.mgmt.keyvault.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 updates on the consumer. + :param action_required: A message indicating if changes on the service provider require any + updates on the consumer. :type action_required: str """ @@ -642,43 +734,78 @@ class PrivateLinkServiceConnectionState(Model): 'action_required': {'key': 'actionRequired', 'type': 'str'}, } - def __init__(self, *, status=None, description: str=None, action_required: str=None, **kwargs) -> None: + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + action_required: Optional[str] = None, + **kwargs + ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description self.action_required = action_required -class ServiceSpecification(Model): +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Resource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, } - def __init__(self, *, log_specifications=None, **kwargs) -> None: + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications -class Sku(Model): +class Sku(msrest.serialization.Model): """SKU details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Default value: "A" . + :ivar family: Required. SKU family name. Default value: "A". :vartype family: str - :param name: Required. SKU name to specify whether the key vault is a - standard vault or a premium vault. Possible values include: 'standard', - 'premium' + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: 'standard', 'premium'. :type name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ @@ -689,21 +816,25 @@ class Sku(Model): _attribute_map = { 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'SkuName'}, + 'name': {'key': 'name', 'type': 'str'}, } family = "A" - def __init__(self, *, name, **kwargs) -> None: + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): super(Sku, self).__init__(**kwargs) self.name = name -class Vault(Model): +class Vault(msrest.serialization.Model): """Resource information with extended details. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -715,9 +846,9 @@ class Vault(Model): :vartype type: str :param location: Azure location of the key vault resource. :type location: str - :param tags: Tags assigned to the key vault resource. + :param tags: A set of tags. Tags assigned to the key vault resource. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ @@ -737,7 +868,14 @@ class Vault(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, properties, location: str=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + properties: "VaultProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -747,11 +885,10 @@ def __init__(self, *, properties, location: str=None, tags=None, **kwargs) -> No self.properties = properties -class VaultAccessPolicyParameters(Model): +class VaultAccessPolicyParameters(msrest.serialization.Model): """Parameters for updating the access policy in a vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. @@ -763,9 +900,8 @@ class VaultAccessPolicyParameters(Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties """ _validation = { @@ -784,7 +920,12 @@ class VaultAccessPolicyParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, } - def __init__(self, *, properties, **kwargs) -> None: + def __init__( + self, + *, + properties: "VaultAccessPolicyProperties", + **kwargs + ): super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -793,16 +934,14 @@ def __init__(self, *, properties, **kwargs) -> None: self.properties = properties -class VaultAccessPolicyProperties(Model): +class VaultAccessPolicyProperties(msrest.serialization.Model): """Properties of the vault access policy. All required parameters must be populated in order to send to Azure. - :param access_policies: Required. An array of 0 to 16 identities that have - access to the key vault. All identities in the array must use the same - tenant ID as the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] """ _validation = { @@ -813,23 +952,27 @@ class VaultAccessPolicyProperties(Model): 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, } - def __init__(self, *, access_policies, **kwargs) -> None: + def __init__( + self, + *, + access_policies: List["AccessPolicyEntry"], + **kwargs + ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies -class VaultCheckNameAvailabilityParameters(Model): +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): """The parameters used to check the availability of the vault name. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. :param name: Required. The vault name. :type name: str - :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. - Default value: "Microsoft.KeyVault/vaults" . + :ivar type: Required. The type of resource, Microsoft.KeyVault/vaults. Default value: + "Microsoft.KeyVault/vaults". :vartype type: str """ @@ -845,22 +988,26 @@ class VaultCheckNameAvailabilityParameters(Model): type = "Microsoft.KeyVault/vaults" - def __init__(self, *, name: str, **kwargs) -> None: + def __init__( + self, + *, + name: str, + **kwargs + ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name -class VaultCreateOrUpdateParameters(Model): +class VaultCreateOrUpdateParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key - vault should be created. + :param location: Required. The supported Azure location where the key vault should be created. :type location: str - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Required. Properties of the vault + :param properties: Required. Properties of the vault. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ @@ -875,21 +1022,53 @@ class VaultCreateOrUpdateParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultProperties'}, } - def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags self.properties = properties -class VaultPatchParameters(Model): +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Vault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: The tags that will be assigned to the key vault. + :param tags: A set of tags. The tags that will be assigned to the key vault. :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties """ _attribute_map = { @@ -897,66 +1076,61 @@ class VaultPatchParameters(Model): 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, } - def __init__(self, *, tags=None, properties=None, **kwargs) -> None: + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["VaultPatchProperties"] = None, + **kwargs + ): super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties -class VaultPatchProperties(Model): +class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used - for authenticating requests to the key vault. + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. :type tenant_id: str - :param sku: SKU details + :param sku: SKU details. :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. - :type access_policies: - list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. Once set to true, it cannot - be reverted to false. + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. :type enable_soft_delete: bool - :param enable_rbac_authorization: Property that controls how data actions - are authorized. When true, the key vault will use Role Based Access - Control (RBAC) for authorization of data actions, and the access policies - specified in vault properties will be ignored (warning: this is a preview - feature). When false, the key vault will use the access policies specified - in vault properties, and any policy stored on Azure Resource Manager will - be ignored. If null or not specified, the value of this property will not - change. + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the value of this property will not change. :type enable_rbac_authorization: bool - :param soft_delete_retention_in_days: softDelete data retention days. It - accepts >=7 and <=90. + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of - the vault from specific network locations. + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet """ @@ -970,12 +1144,28 @@ class VaultPatchProperties(Model): 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, } - def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=None, enable_rbac_authorization: bool=None, soft_delete_retention_in_days: int=None, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: Optional[str] = None, + sku: Optional["Sku"] = None, + access_policies: Optional[List["AccessPolicyEntry"]] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + enable_rbac_authorization: Optional[bool] = None, + soft_delete_retention_in_days: Optional[int] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + **kwargs + ): super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -991,75 +1181,62 @@ def __init__(self, *, tenant_id: str=None, sku=None, access_policies=None, enabl self.network_acls = network_acls -class VaultProperties(Model): +class VaultProperties(msrest.serialization.Model): """Properties of the vault. - Variables are only populated by the server, and will be ignored when - sending a request. + Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :param tenant_id: Required. The Azure Active Directory tenant ID that - should be used for authenticating requests to the key vault. + :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. :type tenant_id: str - :param sku: Required. SKU details + :param sku: Required. SKU details. :type sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to - the key vault. All identities in the array must use the same tenant ID as - the key vault's tenant ID. When `createMode` is set to `recover`, access - policies are not required. Otherwise, access policies are required. - :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 access_policies: An array of 0 to 1024 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual - Machines are permitted to retrieve certificates stored as secrets from the - key vault. + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk - Encryption is permitted to retrieve secrets from the vault and unwrap - keys. + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure - Resource Manager is permitted to retrieve secrets from the key vault. + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' - functionality is enabled for this key vault. If it's not set to any - value(true or false) when creating new key vault, it will be set to true - by default. Once set to true, it cannot be reverted to false. Default - value: True . + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It - accepts >=7 and <=90. Default value: 90 . + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int - :param enable_rbac_authorization: Property that controls how data actions - are authorized. When true, the key vault will use Role Based Access - Control (RBAC) for authorization of data actions, and the access policies - specified in vault properties will be ignored (warning: this is a preview - feature). When false, the key vault will use the access policies specified - in vault properties, and any policy stored on Azure Resource Manager will - be ignored. If null or not specified, the vault is created with the - default value of false. Note that management actions are always authorized - with RBAC. Default value: False . + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the vault is created with the default value of false. Note that management + actions are always authorized with RBAC. :type enable_rbac_authorization: bool - :param create_mode: The vault's create mode to indicate whether the vault - need to be recovered or not. Possible values include: 'recover', 'default' - :type create_mode: str or - ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode - :param enable_purge_protection: Property specifying whether protection - against purge is enabled for this vault. Setting this property to true - activates protection against purge for this vault and its content - only - the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this - functionality is irreversible - that is, the property does not accept - false as its value. + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: 'recover', 'default'. + :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault - from specific network locations. + :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 - :ivar private_endpoint_connections: List of private endpoint connections - associated with the key vault. + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionItem] """ @@ -1081,13 +1258,30 @@ class VaultProperties(Model): 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'CreateMode'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, } - def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str=None, enabled_for_deployment: bool=None, enabled_for_disk_encryption: bool=None, enabled_for_template_deployment: bool=None, enable_soft_delete: bool=True, soft_delete_retention_in_days: int=90, enable_rbac_authorization: bool=False, create_mode=None, enable_purge_protection: bool=None, network_acls=None, **kwargs) -> None: + def __init__( + self, + *, + tenant_id: str, + sku: "Sku", + access_policies: Optional[List["AccessPolicyEntry"]] = None, + vault_uri: Optional[str] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = True, + soft_delete_retention_in_days: Optional[int] = 90, + enable_rbac_authorization: Optional[bool] = False, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + **kwargs + ): super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1105,14 +1299,14 @@ def __init__(self, *, tenant_id: str, sku, access_policies=None, vault_uri: str= self.private_endpoint_connections = None -class VirtualNetworkRule(Model): - """A rule governing the accessibility of a vault from a specific virtual - network. +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. All required parameters must be populated in order to send to Azure. :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test- + vnet/subnets/subnet1'. :type id: str """ @@ -1124,6 +1318,11 @@ class VirtualNetworkRule(Model): 'id': {'key': 'id', 'type': 'str'}, } - def __init__(self, *, id: str, **kwargs) -> None: + def __init__( + self, + *, + id: str, + **kwargs + ): super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py deleted file mode 100644 index 4eaaf416a4bd..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_paged_models.py +++ /dev/null @@ -1,66 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class VaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`Vault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Vault]'} - } - - def __init__(self, *args, **kwargs): - - super(VaultPaged, self).__init__(*args, **kwargs) -class DeletedVaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedVault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedVault]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedVaultPaged, self).__init__(*args, **kwargs) -class ResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`Resource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Resource]'} - } - - def __init__(self, *args, **kwargs): - - super(ResourcePaged, self).__init__(*args, **kwargs) -class OperationPaged(Paged): - """ - A paging container for iterating over a list of :class:`Operation ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Operation]'} - } - - def __init__(self, *args, **kwargs): - - super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index 70f7bdab83d8..ad4413dd4cae 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 @@ -1,12 +1,9 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from ._vaults_operations import VaultsOperations 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 5ab03310f4ee..56c0f275f327 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 @@ -1,102 +1,101 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import 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 +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class Operations(object): """Operations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: Client Api Version. Constant value: "2019-09-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-09-01" - - self.config = config + self._config = config def list( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.OperationListResult" """Lists all of the available Key Vault Rest API operations. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Operation - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.OperationPaged[~azure.mgmt.keyvault.v2019_09_01.models.Operation] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} 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 208948960654..2c1e28e497f4 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 @@ -1,303 +1,284 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: Client Api Version. Constant value: "2019-09-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-09-01" - - self.config = config + self._config = config def get( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): - """Gets the specified private endpoint connection associated with the key - vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # 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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + # Construct URL url = self.get.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} def put( - self, resource_group_name, vault_name, private_endpoint_connection_name, properties, custom_headers=None, raw=False, **operation_config): - """Updates the specified private endpoint connection associated with the - key vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # 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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str :param properties: The intended state of private endpoint connection. - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateEndpointConnection or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection + :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 + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL url = self.put.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(properties, 'PrivateEndpointConnection') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + 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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - header_dict = {} - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) - header_dict = { - 'Retry-After': 'int', - 'Azure-AsyncOperation': 'str', - } + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, response_headers) return deserialized put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} - def _delete_initial( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + # Construct URL - url = self.delete.metadata['url'] + url = self._delete_initial.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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') + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + response_headers = {} deserialized = None - header_dict = {} - if response.status_code == 200: - deserialized = self._deserialize('PrivateEndpointConnection', response) - header_dict = { - 'Retry-After': 'int', - 'Location': 'str', - } + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) - return deserialized + if cls: + return cls(pipeline_response, deserialized, response_headers) - def delete( - self, resource_group_name, vault_name, private_endpoint_connection_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Deletes the specified private endpoint connection associated with the - key vault. - - :param resource_group_name: Name of the resource group that contains - the key vault. + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def begin_delete( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param private_endpoint_connection_name: Name of the private endpoint - connection associated with the key vault. + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. :type private_endpoint_connection_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns - PrivateEndpointConnection or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] raw_result = self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - header_dict = { - 'Retry-After': 'int', - 'Location': 'str', - } - deserialized = self._deserialize('PrivateEndpointConnection', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - client_raw_response.add_headers(header_dict) - return client_raw_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/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 db5d194a712e..4578a5326af5 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 @@ -1,104 +1,97 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar api_version: Client Api Version. Constant value: "2019-09-01". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2019-09-01" - - self.config = config + self._config = config def list_by_vault( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # 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. + :param resource_group_name: Name of the resource group that contains the key vault. :type resource_group_name: str :param vault_name: The name of the key vault. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: PrivateLinkResourceListResult or ClientRawResponse if - raw=true - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult - or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + # Construct URL url = self.list_by_vault.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + '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}$') + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('PrivateLinkResourceListResult', response) + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index d1555ea8b5c6..fb64dc1f79d0 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 @@ -1,247 +1,247 @@ # 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. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings -import uuid -from msrest.pipeline import ClientRawResponse -from msrestazure.azure_exceptions import CloudError -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling +from azure.core.exceptions import 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.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. - You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + 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. - :ivar filter: The filter to apply on the operation. Constant value: "resourceType eq 'Microsoft.KeyVault/vaults'". """ models = models def __init__(self, client, config, serializer, deserializer): - self._client = client self._serialize = serializer self._deserialize = deserializer - self.filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - - self.config = config - + self._config = config def _create_or_update_initial( - self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update.metadata['url'] + url = self._create_or_update_initial.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - - def create_or_update( - self, resource_group_name, vault_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config): + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + + def begin_create_or_update( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param parameters: Parameters to create or update the vault - :type parameters: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :param parameters: Parameters to create or update the vault. + :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 polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns Vault or - ClientRawResponse if raw==True - :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.keyvault.v2019_09_01.models.Vault]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - deserialized = self._deserialize('Vault', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update( - self, resource_group_name, vault_name, tags=None, properties=None, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultPatchParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the server belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param tags: The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultPatchParameters(tags=tags, properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultPatchParameters') # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def delete( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Deletes the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: The name of the vault to delete + :param vault_name: The name of the vault to delete. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: None or ClientRawResponse if raw=true - :rtype: None or ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" # Construct URL @@ -249,56 +249,51 @@ def delete( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 204]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def get( - self, resource_group_name, vault_name, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Vault" """Gets the specified Azure key vault. - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param vault_name: The name of the vault. :type vault_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" # Construct URL @@ -306,145 +301,129 @@ def get( path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Vault', response) + deserialized = self._deserialize('Vault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} def update_access_policy( - self, resource_group_name, vault_name, operation_kind, properties, custom_headers=None, raw=False, **operation_config): + self, + resource_group_name, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "models.AccessPolicyUpdateKind"] + parameters, # type: "models.VaultAccessPolicyParameters" + **kwargs # type: Any + ): + # 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. + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str - :param vault_name: Name of the vault + :param vault_name: Name of the vault. :type vault_name: str - :param operation_kind: Name of the operation. Possible values include: - 'add', 'replace', 'remove' - :type operation_kind: str or - ~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyUpdateKind - :param properties: Properties of the access policy - :type properties: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: VaultAccessPolicyParameters or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError """ - parameters = models.VaultAccessPolicyParameters(properties=properties) - + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.update_access_policy.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'AccessPolicyUpdateKind'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + 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, 201]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = None if response.status_code == 200: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + if response.status_code == 201: - deserialized = self._deserialize('VaultAccessPolicyParameters', response) + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} def list_by_resource_group( - self, resource_group_name, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription and within the specified resource group. - - :param resource_group_name: The name of the Resource Group to which - the vault belongs. + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultPaged[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" def prepare_request(next_link=None): @@ -453,72 +432,67 @@ def prepare_request(next_link=None): url = self.list_by_resource_group.metadata['url'] path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} def list_by_subscription( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.VaultListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Vault - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.VaultPaged[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" def prepare_request(next_link=None): @@ -526,69 +500,64 @@ def prepare_request(next_link=None): # Construct URL url = self.list_by_subscription.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.VaultPaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} def list_deleted( - self, custom_headers=None, raw=False, **operation_config): + self, + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVaultListResult" """Gets information about the deleted vaults in a subscription. - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of DeletedVault - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" def prepare_request(next_link=None): @@ -596,71 +565,68 @@ def prepare_request(next_link=None): # Construct URL url = self.list_deleted.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp - - return response + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.DeletedVaultPaged(internal_paging, self._deserialize.dependencies, header_dict) + return pipeline_response - return deserialized + return ItemPaged( + get_next, extract_data + ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} def get_deleted( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. :type vault_name: str :param location: The location of the deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: DeletedVault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" # Construct URL @@ -668,262 +634,244 @@ def get_deleted( 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') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedVault', response) + deserialized = self._deserialize('DeletedVault', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} - def _purge_deleted_initial( - self, vault_name, location, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" # Construct URL - url = self.purge_deleted.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + header_parameters = {} # type: Dict[str, Any] # Construct and send request request = self._client.post(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200, 202]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} - def purge_deleted( - self, vault_name, location, custom_headers=None, raw=False, polling=True, **operation_config): - """Permanently deletes the specified vault. aka Purges the deleted Azure - key vault. + def begin_purge_deleted( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. :type vault_name: str :param location: The location of the soft-deleted vault. :type location: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: :class:`CloudError` + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, - custom_headers=custom_headers, - raw=True, - **operation_config + cls=lambda x,y,z: x, + **kwargs ) - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} def list( - self, top=None, custom_headers=None, raw=False, **operation_config): - """The List operation gets information about the vaults associated with - the subscription. + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> "models.ResourceListResult" + """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: An iterator like instance of Resource - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.ResourcePaged[~azure.mgmt.keyvault.v2019_09_01.models.Resource] - :raises: :class:`CloudError` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ResourceListResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = "2015-11-01" + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL url = self.list.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['$filter'] = self._serialize.query("self.filter", self.filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - else: url = next_link - query_parameters = {} + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', 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) - response = self._client.send(request, stream=False, **operation_config) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response if response.status_code not in [200]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - return response + return pipeline_response - # Deserialize response - header_dict = None - if raw: - header_dict = {} - deserialized = models.ResourcePaged(internal_paging, self._deserialize.dependencies, header_dict) - - return deserialized + return ItemPaged( + get_next, extract_data + ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} def check_name_availability( - self, name, custom_headers=None, raw=False, **operation_config): + self, + vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. - :param name: The vault name. - :type name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: CheckNameAvailabilityResult or ClientRawResponse if raw=true - :rtype: - ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError """ - vault_name = models.VaultCheckNameAvailabilityParameters(name=name) - + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL url = self.check_name_availability.metadata['url'] path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str') + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) # Construct parameters - query_parameters = {} + query_parameters = {} # type: Dict[str, Any] query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') # Construct headers - header_parameters = {} + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self.config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if custom_headers: - header_parameters.update(custom_headers) - if self.config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') - - # Construct body - body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - response = self._client.send(request, stream=False, **operation_config) + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(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]: - exp = CloudError(response) - exp.request_id = response.headers.get('x-ms-request-id') - raise exp + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CheckNameAvailabilityResult', response) + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + if cls: + return cls(pipeline_response, deserialized, {}) return deserialized check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt b/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt deleted file mode 100644 index f6457a93d5e8..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt +++ /dev/null @@ -1 +0,0 @@ --e ../../../tools/azure-sdk-tools \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/sdk_packaging.toml b/sdk/keyvault/azure-mgmt-keyvault/sdk_packaging.toml index 6d33bc0f26af..1fe6fdf19239 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/sdk_packaging.toml +++ b/sdk/keyvault/azure-mgmt-keyvault/sdk_packaging.toml @@ -1,5 +1,9 @@ [packaging] package_name = "azure-mgmt-keyvault" -package_pprint_name = "Key Vault Management" -package_doc_id = "key-vault" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" is_stable = false +is_arm = true +need_msrestazure = false +need_azurecore = true diff --git a/sdk/keyvault/azure-mgmt-keyvault/setup.py b/sdk/keyvault/azure-mgmt-keyvault/setup.py index a69d42f38a99..4da537083da0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/setup.py +++ b/sdk/keyvault/azure-mgmt-keyvault/setup.py @@ -13,7 +13,7 @@ # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "azure-mgmt-keyvault" -PACKAGE_PPRINT_NAME = "Key Vault Management" +PACKAGE_PPRINT_NAME = "MyService Management" # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace('-', '/') @@ -36,7 +36,9 @@ pass # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py'), 'r') as fd: +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -79,8 +81,8 @@ ]), install_requires=[ 'msrest>=0.5.0', - 'msrestazure>=0.4.32,<2.0.0', 'azure-common~=1.1', + 'azure-mgmt-core>=1.0.0,<2.0.0', ], extras_require={ ":python_version<'3.0'": ['azure-mgmt-nspkg'], diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml index 63df207cc510..bb53466e8078 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: 'b''{"location": "westus", "properties": {"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + body: 'b''{"location": "eastus", "properties": {"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "sku": {"family": "A", "name": "standard"}, "accessPolicies": [{"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", "objectId": "00000000-0000-0000-0000-000000000000", "permissions": {"keys": ["encrypt", "decrypt", "wrapKey", "unwrapKey", "sign", @@ -20,26 +20,127 @@ interactions: Content-Length: - '823' Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxy.vault.azure.net","provisioningState":"RegisteringDns"}}' + headers: + cache-control: + - no-cache + content-length: + - '1113' + content-type: - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:44:50 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-keyvault/2.2.0 Azure-SDK-For-Python - accept-language: - - en-US + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' + headers: + cache-control: + - no-cache + content-length: + - '1109' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:20 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: 'b''{"properties": {"accessPolicies": [{"tenantId": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "objectId": "00000000-0000-0000-0000-000000000000", "permissions": {"keys": + ["encrypt"], "secrets": ["get"], "certificates": ["get"]}}]}}''' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '225' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/add?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss","name":"myVaultSss","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myVaultSss.vault.azure.net","provisioningState":"RegisteringDns"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' headers: cache-control: - no-cache content-length: - - '1101' + - '792' content-type: - application/json; charset=utf-8 date: - - Wed, 15 Apr 2020 13:13:24 GMT + - Wed, 29 Apr 2020 10:45:21 GMT expires: - '-1' pragma: @@ -57,7 +158,7 @@ interactions: x-content-type-options: - nosniff x-ms-keyvault-service-version: - - 1.1.0.276 + - 1.1.0.277 x-ms-ratelimit-remaining-subscription-writes: - '1198' x-powered-by: @@ -75,22 +176,21 @@ interactions: Connection: - keep-alive User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-keyvault/2.2.0 Azure-SDK-For-Python + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss","name":"myVaultSss","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaultsss.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '1097' + - '1109' content-type: - application/json; charset=utf-8 date: - - Wed, 15 Apr 2020 13:13:58 GMT + - Wed, 29 Apr 2020 10:45:21 GMT expires: - '-1' pragma: @@ -108,14 +208,14 @@ interactions: x-content-type-options: - nosniff x-ms-keyvault-service-version: - - 1.1.0.276 + - 1.1.0.277 x-powered-by: - ASP.NET status: code: 200 message: OK - request: - body: null + body: '{}' headers: Accept: - application/json @@ -123,25 +223,26 @@ interactions: - gzip, deflate Connection: - keep-alive + Content-Length: + - '2' + Content-Type: + - application/json User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-keyvault/2.2.0 Azure-SDK-For-Python - accept-language: - - en-US - method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss?api-version=2019-09-01 + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss","name":"myVaultSss","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaultsss.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: - no-cache content-length: - - '1097' + - '1109' content-type: - application/json; charset=utf-8 date: - - Wed, 15 Apr 2020 13:13:58 GMT + - Wed, 29 Apr 2020 10:45:22 GMT expires: - '-1' pragma: @@ -159,7 +260,9 @@ interactions: x-content-type-options: - nosniff x-ms-keyvault-service-version: - - 1.1.0.276 + - 1.1.0.277 + x-ms-ratelimit-remaining-subscription-writes: + - '1197' x-powered-by: - ASP.NET status: @@ -177,12 +280,9 @@ interactions: Content-Length: - '61' Content-Type: - - application/json; charset=utf-8 + - application/json User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-keyvault/2.2.0 Azure-SDK-For-Python - accept-language: - - en-US + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: POST uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2019-09-01 response: @@ -197,7 +297,7 @@ interactions: content-type: - application/json; charset=utf-8 date: - - Wed, 15 Apr 2020 13:13:58 GMT + - Wed, 29 Apr 2020 10:45:22 GMT expires: - '-1' pragma: @@ -215,7 +315,7 @@ interactions: x-content-type-options: - nosniff x-ms-keyvault-service-version: - - 1.1.0.276 + - 1.1.0.277 x-powered-by: - ASP.NET status: @@ -225,7 +325,7 @@ interactions: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: @@ -233,12 +333,9 @@ interactions: Content-Length: - '0' User-Agent: - - python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) msrest/0.6.10 - msrest_azure/0.6.2 azure-mgmt-keyvault/2.2.0 Azure-SDK-For-Python - accept-language: - - en-US + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myVaultSss?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: string: '' @@ -248,7 +345,7 @@ interactions: content-length: - '0' date: - - Wed, 15 Apr 2020 13:14:01 GMT + - Wed, 29 Apr 2020 10:45:25 GMT expires: - '-1' pragma: @@ -262,9 +359,292 @@ interactions: x-content-type-options: - nosniff x-ms-keyvault-service-version: - - 1.1.0.276 + - 1.1.0.277 x-ms-ratelimit-remaining-subscription-deletes: - - '14998' + - '14999' + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","location":"eastus","tags":{},"deletionDate":"2020-04-29T10:45:24Z","scheduledPurgeDate":"2020-07-28T10:45:24Z"}}' + headers: + cache-control: + - no-cache + content-length: + - '503' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:25 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-powered-by: + - ASP.NET + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy/purge?api-version=2019-09-01 + response: + body: + string: '' + headers: + cache-control: + - no-cache + content-length: + - '0' + date: + - Wed, 29 Apr 2020 10:45:26 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-ms-ratelimit-remaining-subscription-writes: + - '1199' + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-04-29 10:45:26Z","status":"NotStarted"}' + headers: + cache-control: + - no-cache + content-length: + - '64' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:31 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-04-29 10:45:26Z","status":"NotStarted"}' + headers: + cache-control: + - no-cache + content-length: + - '64' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:36 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-04-29 10:45:26Z","status":"NotStarted"}' + headers: + cache-control: + - no-cache + content-length: + - '64' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:41 GMT + expires: + - '-1' + location: + - https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 + x-powered-by: + - ASP.NET + status: + code: 202 + message: Accepted +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzIzNzUzOTI3NzYyNzYxOHw0MjIwOTIzNUM4Mzk0Q0RDQTJDQTg0QjkzRTNDQjg3Mg?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-04-29 10:45:26Z","lastActionDateTime":"2020-04-29 + 10:45:42Z","status":"Succeeded"}' + headers: + cache-control: + - no-cache + content-length: + - '107' + content-type: + - application/json; charset=utf-8 + date: + - Wed, 29 Apr 2020 10:45:46 GMT + expires: + - '-1' + pragma: + - no-cache + server: + - Microsoft-IIS/10.0 + strict-transport-security: + - max-age=31536000; includeSubDomains + transfer-encoding: + - chunked + vary: + - Accept-Encoding + x-aspnet-version: + - 4.0.30319 + x-content-type-options: + - nosniff + x-ms-keyvault-service-version: + - 1.1.0.277 x-powered-by: - ASP.NET status: diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py index c751ff8c08b2..b2e334b5502a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py @@ -35,24 +35,25 @@ def setUp(self): def test_keyvault(self, resource_group): SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = "72f988bf-86f1-41af-91ab-2d7cd011db47" # self.settings.TENANT_ID RESOURCE_GROUP = resource_group.name - VAULT_NAME = "myVaultSss" + VAULT_NAME = "myValtZikfikxy" OPERATION_KIND = "add" LOCATION = "eastus" PRIVATE_ENDPOINT_CONNECTION_NAME = "myPrivateEndpointConnection" # /Vaults/put/Create a new vault or update an existing vault[put] BODY = { - "location": "westus", + "location": LOCATION, "properties": { - "tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenant_id": TENANT_ID, "sku": { "family": "A", "name": "standard" }, "access_policies": [ { - "tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenant_id": TENANT_ID, "object_id": "00000000-0000-0000-0000-000000000000", "permissions": { "keys": [ @@ -107,12 +108,12 @@ def test_keyvault(self, resource_group): "enabled_for_template_deployment": True } } - result = self.mgmt_client.vaults.create_or_update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=BODY) + result = self.mgmt_client.vaults.begin_create_or_update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=BODY) result = result.result() # /Vaults/put/Create or update a vault with network acls[put] BODY = { - "location": "westus", + "location": LOCATION, "properties": { "tenant_id": "00000000-0000-0000-0000-000000000000", "sku": { @@ -145,9 +146,11 @@ def test_keyvault(self, resource_group): #result = result.result() # /Vaults/put/Add an access policy, or update an access policy with new permissions[put] - PROPERTIES = [ + PARAMETERS = { + "properties": { + "access_policies": [ { - "tenant_id": "00000000-0000-0000-0000-000000000000", + "tenant_id": TENANT_ID, "object_id": "00000000-0000-0000-0000-000000000000", "permissions": { "keys": [ @@ -161,8 +164,11 @@ def test_keyvault(self, resource_group): ] } } - ] - # result = self.mgmt_client.vaults.update_access_policy(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, operation_kind=OPERATION_KIND, properties=PROPERTIES) + ] + } + } + + result = self.mgmt_client.vaults.update_access_policy(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, operation_kind=OPERATION_KIND, parameters=PARAMETERS) # /PrivateEndpointConnections/put/KeyVaultPutPrivateEndpointConnection[put] BODY = { @@ -199,14 +205,14 @@ def test_keyvault(self, resource_group): # /Vaults/patch/Update an existing vault[patch] PROPERTIES = { - "tenant_id": "72f988bf-86f1-41af-91ab-2d7cd011db47", + "tenant_id": TENANT_ID, "sku": { "family": "A", "name": "standard" }, "access_policies": [ { - "tenant_id": "00000000-0000-0000-0000-000000000000", + "tenant_id": TENANT_ID, "object_id": "00000000-0000-0000-0000-000000000000", "permissions": { "keys": [ @@ -260,10 +266,10 @@ def test_keyvault(self, resource_group): "enabled_for_disk_encryption": True, "enabled_for_template_deployment": True } - # result = self.mgmt_client.vaults.update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, properties=PROPERTIES) + result = self.mgmt_client.vaults.update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=PROPERTIES) # /Vaults/post/Validate a vault name[post] - result = self.mgmt_client.vaults.check_name_availability(name="sample-vault", type="Microsoft.KeyVault/vaults") + result = self.mgmt_client.vaults.check_name_availability({ 'name': 'sample-vault', 'type': 'Microsoft.KeyVault/vaults' }) # /PrivateEndpointConnections/delete/KeyVaultDeletePrivateEndpointConnection[delete] # result = self.mgmt_client.private_endpoint_connections.delete(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) @@ -273,11 +279,11 @@ def test_keyvault(self, resource_group): result = self.mgmt_client.vaults.delete(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME) # /Vaults/get/Retrieve a deleted vault[get] - # result = self.mgmt_client.vaults.get_deleted(location=LOCATION, vault_name=VAULT_NAME) + result = self.mgmt_client.vaults.get_deleted(location=LOCATION, vault_name=VAULT_NAME) # /Vaults/post/Purge a deleted vault[post] - # result = self.mgmt_client.vaults.purge_deleted(location=LOCATION, vault_name=VAULT_NAME) - # result = result.result() + result = self.mgmt_client.vaults.begin_purge_deleted(location=LOCATION, vault_name=VAULT_NAME) + result = result.result() #------------------------------------------------------------------------------ if __name__ == '__main__': From 9295f988df1f50e9b034709f6b42891e132a73e1 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Mon, 18 May 2020 11:28:43 +0000 Subject: [PATCH 2/9] preview.7 --- .../azure/mgmt/keyvault/__init__.py | 6 + .../azure/mgmt/keyvault/_configuration.py | 3 +- .../keyvault/_key_vault_management_client.py | 17 +- .../azure/mgmt/keyvault/aio/__init__.py | 10 + .../mgmt/keyvault/aio/_configuration_async.py | 64 +++++ .../aio/_key_vault_management_client_async.py | 177 +++++++++++++ .../mgmt/keyvault/v2016_10_01/__init__.py | 6 + .../keyvault/v2016_10_01/_configuration.py | 11 +- .../_key_vault_management_client.py | 11 +- .../mgmt/keyvault/v2016_10_01/_metadata.json | 61 +++-- .../v2016_10_01/aio/_configuration_async.py | 11 +- .../aio/_key_vault_management_client_async.py | 11 +- .../aio/operations_async/_operations_async.py | 25 +- .../_vaults_operations_async.py | 219 ++++++++-------- .../_key_vault_management_client_enums.py | 86 +++---- .../keyvault/v2016_10_01/models/_models.py | 36 +-- .../v2016_10_01/models/_models_py3.py | 12 +- .../v2016_10_01/operations/_operations.py | 33 ++- .../operations/_vaults_operations.py | 227 ++++++++-------- .../mgmt/keyvault/v2018_02_14/__init__.py | 6 + .../keyvault/v2018_02_14/_configuration.py | 11 +- .../_key_vault_management_client.py | 11 +- .../mgmt/keyvault/v2018_02_14/_metadata.json | 61 +++-- .../v2018_02_14/aio/_configuration_async.py | 11 +- .../aio/_key_vault_management_client_async.py | 11 +- .../aio/operations_async/_operations_async.py | 25 +- ...e_endpoint_connections_operations_async.py | 50 ++-- ...private_link_resources_operations_async.py | 11 +- .../_vaults_operations_async.py | 234 +++++++++-------- .../_key_vault_management_client_enums.py | 150 +++++------ .../keyvault/v2018_02_14/models/_models.py | 48 ++-- .../v2018_02_14/models/_models_py3.py | 22 +- .../v2018_02_14/operations/_operations.py | 33 ++- ...private_endpoint_connections_operations.py | 60 +++-- .../_private_link_resources_operations.py | 21 +- .../operations/_vaults_operations.py | 242 ++++++++++-------- .../mgmt/keyvault/v2019_09_01/__init__.py | 6 + .../keyvault/v2019_09_01/_configuration.py | 11 +- .../_key_vault_management_client.py | 11 +- .../mgmt/keyvault/v2019_09_01/_metadata.json | 61 +++-- .../v2019_09_01/aio/_configuration_async.py | 11 +- .../aio/_key_vault_management_client_async.py | 11 +- .../aio/operations_async/_operations_async.py | 25 +- ...e_endpoint_connections_operations_async.py | 50 ++-- ...private_link_resources_operations_async.py | 11 +- .../_vaults_operations_async.py | 234 +++++++++-------- .../_key_vault_management_client_enums.py | 150 +++++------ .../keyvault/v2019_09_01/models/_models.py | 48 ++-- .../v2019_09_01/models/_models_py3.py | 22 +- .../v2019_09_01/operations/_operations.py | 33 ++- ...private_endpoint_connections_operations.py | 60 +++-- .../_private_link_resources_operations.py | 21 +- .../operations/_vaults_operations.py | 242 ++++++++++-------- 53 files changed, 1811 insertions(+), 1229 deletions(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py index f54ed88d6ad2..1f618cc50426 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/__init__.py @@ -8,3 +8,9 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass 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 1d8bc19817d8..543a28f80679 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -23,7 +23,7 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ @@ -44,6 +44,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) 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 25e735d388dd..4bee764af805 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 @@ -35,16 +35,15 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): group is not described in the profile. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential - :param subscription_id: Subscription credential which uniquely identify - Microsoft Azure subscription. The subscription ID forms part of the URI - for every service call. + :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 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. """ DEFAULT_API_VERSION = '2019-09-01' @@ -56,7 +55,15 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): _PROFILE_TAG + " latest" ) - def __init__(self, credential, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default, **kwargs): + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ): if not base_url: base_url = 'https://management.azure.com' self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py new file mode 100644 index 000000000000..018d48d4060b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._key_vault_management_client_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration_async.py new file mode 100644 index 000000000000..24531c2b2763 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration_async.py @@ -0,0 +1,64 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :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. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "AsyncTokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ) -> None: + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) + kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..f8518d26e458 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py @@ -0,0 +1,177 @@ +# 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 azure.mgmt.core import AsyncARMPipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration_async import KeyVaultManagementClientConfiguration + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :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. + :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 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. + """ + + DEFAULT_API_VERSION = '2019-09-01' + _PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "AsyncTokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(KeyVaultManagementClient, self).__init__( + credential, + self._config, + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2016-10-01: :mod:`v2016_10_01.models` + * 2018-02-14: :mod:`v2018_02_14.models` + * 2019-09-01: :mod:`v2019_09_01.models` + """ + if api_version == '2016-10-01': + from ..v2016_10_01 import models + return models + elif api_version == '2018-02-14': + from ..v2018_02_14 import models + return models + elif api_version == '2019-09-01': + from ..v2019_09_01 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def operations(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`Operations` + * 2018-02-14: :class:`Operations` + * 2019-09-01: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import Operations as OperationClass + elif api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import Operations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateEndpointConnectionsOperations` + * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateLinkResourcesOperations` + * 2019-09-01: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import PrivateLinkResourcesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def vaults(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`VaultsOperations` + * 2018-02-14: :class:`VaultsOperations` + * 2019-09-01: :class:`VaultsOperations` + """ + api_version = self._get_api_version('vaults') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import VaultsOperations as OperationClass + elif api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import VaultsOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import VaultsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): + await self._client.__aenter__() + return self + async def __aexit__(self, *exc_details): + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py index f54ed88d6ad2..1f618cc50426 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py @@ -8,3 +8,9 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py index 174f81c5a513..21fb446b5bbf 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py @@ -6,11 +6,17 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,7 +26,7 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ @@ -42,6 +48,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2016-10-01" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) 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 f7393a4018f4..500005a28477 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 @@ -6,11 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations from .operations import Operations @@ -25,10 +31,11 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( 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 ed02534b138e..4013a1d68e64 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 @@ -4,36 +4,51 @@ "client": { "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", - "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "has_subscription_id": true + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault." }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "package_version": false, - "global_parameters": { - "method": { - "credential": { - "method_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", - "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 - } + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true }, - "constant": { + "subscription_id": { + "method_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 } - } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] }, "operation_groups": { "vaults": "VaultsOperations", "operations": "Operations" }, "operation_mixins": { - } + }, + "sync_imports": "None", + "async_imports": "None" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py index 5d2c16036fc1..ab079a4c9bf2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py @@ -6,11 +6,15 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,14 +24,14 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any ) -> None: @@ -41,6 +45,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2016-10-01" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py index e05eb8d9dd56..8e74ff9427af 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py @@ -6,11 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + from ._configuration_async import KeyVaultManagementClientConfiguration from .operations_async import VaultsOperations from .operations_async import Operations @@ -25,15 +29,16 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2016_10_01.aio.operations_async.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py index 94bbd19f5f80..47ecb3338309 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -44,29 +44,30 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -97,4 +98,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py index cf20faf1cba5..c92eb0b5a807 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -59,17 +59,18 @@ async def create_or_update( :param parameters: Parameters to create or update the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore 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}$'), @@ -107,10 +108,10 @@ async def create_or_update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update( self, @@ -128,17 +129,18 @@ async def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -176,10 +178,10 @@ async def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def delete( self, @@ -194,16 +196,17 @@ async def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -228,9 +231,9 @@ async def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def get( self, @@ -245,16 +248,17 @@ async def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -282,10 +286,10 @@ async def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update_access_policy( self, @@ -306,17 +310,18 @@ async def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -355,17 +360,17 @@ async def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> "models.VaultListResult": + ) -> AsyncIterable["models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -373,32 +378,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -429,43 +435,44 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -496,38 +503,39 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs - ) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -558,7 +566,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore async def get_deleted( self, @@ -573,16 +581,17 @@ async def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -610,10 +619,10 @@ async def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore async def _purge_deleted_initial( self, @@ -622,11 +631,12 @@ async def _purge_deleted_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -651,9 +661,9 @@ async def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore async def purge_deleted( self, @@ -671,13 +681,17 @@ async def purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: None, or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -685,57 +699,57 @@ async def purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -766,7 +780,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore async def check_name_availability( self, @@ -778,17 +792,18 @@ async def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -819,7 +834,7 @@ async def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py index 0854ac966255..4fc1675be016 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py @@ -8,6 +8,36 @@ from enum import Enum +class AccessPolicyUpdateKind(str, Enum): + + add = "add" + replace = "replace" + remove = "remove" + +class CertificatePermissions(str, Enum): + + get = "get" + list = "list" + delete = "delete" + create = "create" + import_enum = "import" + update = "update" + managecontacts = "managecontacts" + getissuers = "getissuers" + listissuers = "listissuers" + setissuers = "setissuers" + deleteissuers = "deleteissuers" + manageissuers = "manageissuers" + recover = "recover" + purge = "purge" + +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + class KeyPermissions(str, Enum): encrypt = "encrypt" @@ -27,6 +57,14 @@ class KeyPermissions(str, Enum): recover = "recover" purge = "purge" +class Reason(str, Enum): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ + + account_name_invalid = "AccountNameInvalid" + already_exists = "AlreadyExists" + class SecretPermissions(str, Enum): get = "get" @@ -38,22 +76,12 @@ class SecretPermissions(str, Enum): recover = "recover" purge = "purge" -class CertificatePermissions(str, Enum): +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ - get = "get" - list = "list" - delete = "delete" - create = "create" - import_enum = "import" - update = "update" - managecontacts = "managecontacts" - getissuers = "getissuers" - listissuers = "listissuers" - setissuers = "setissuers" - deleteissuers = "deleteissuers" - manageissuers = "manageissuers" - recover = "recover" - purge = "purge" + standard = "standard" + premium = "premium" class StoragePermissions(str, Enum): @@ -71,31 +99,3 @@ class StoragePermissions(str, Enum): listsas = "listsas" getsas = "getsas" deletesas = "deletesas" - -class SkuName(str, Enum): - """SKU name to specify whether the key vault is a standard vault or a premium vault. - """ - - standard = "standard" - premium = "premium" - -class CreateMode(str, Enum): - """The vault's create mode to indicate whether the vault need to be recovered or not. - """ - - recover = "recover" - default = "default" - -class Reason(str, Enum): - """The reason that a vault name could not be used. The Reason element is only returned if - NameAvailable is false. - """ - - account_name_invalid = "AccountNameInvalid" - already_exists = "AlreadyExists" - -class AccessPolicyUpdateKind(str, Enum): - - add = "add" - replace = "replace" - remove = "remove" 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 3aba9508f0be..f26c983f206c 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 @@ -45,10 +45,10 @@ def __init__( **kwargs ): super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.object_id = kwargs.get('object_id', None) + self.tenant_id = kwargs['tenant_id'] + self.object_id = kwargs['object_id'] self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs.get('permissions', None) + self.permissions = kwargs['permissions'] class CheckNameAvailabilityResult(msrest.serialization.Model): @@ -61,8 +61,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -382,7 +382,7 @@ def __init__( self.id = None self.name = None self.type = None - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -438,7 +438,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ @@ -459,7 +459,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class Vault(Resource): @@ -505,7 +505,7 @@ def __init__( **kwargs ): super(Vault, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyParameters(msrest.serialization.Model): @@ -552,7 +552,7 @@ def __init__( self.name = None self.type = None self.location = None - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyProperties(msrest.serialization.Model): @@ -578,7 +578,7 @@ def __init__( **kwargs ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs.get('access_policies', None) + self.access_policies = kwargs['access_policies'] class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -612,7 +612,7 @@ def __init__( **kwargs ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class VaultCreateOrUpdateParameters(msrest.serialization.Model): @@ -644,9 +644,9 @@ def __init__( **kwargs ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultListResult(msrest.serialization.Model): @@ -719,7 +719,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. The property may not be set to false. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault; it is only effective if soft delete is also enabled. Once activated, the @@ -787,7 +787,7 @@ class VaultProperties(msrest.serialization.Model): that is, the property does not accept false as its value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -820,8 +820,8 @@ def __init__( **kwargs ): super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) + self.tenant_id = kwargs['tenant_id'] + self.sku = kwargs['sku'] self.access_policies = kwargs.get('access_policies', None) self.vault_uri = kwargs.get('vault_uri', None) self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) 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 3716345360f6..3259e4b659a7 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 @@ -10,6 +10,8 @@ import msrest.serialization +from ._key_vault_management_client_enums import * + class AccessPolicyEntry(msrest.serialization.Model): """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. @@ -68,8 +70,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -480,7 +482,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ @@ -783,7 +785,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. The property may not be set to false. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault; it is only effective if soft delete is also enabled. Once activated, the @@ -861,7 +863,7 @@ class VaultProperties(msrest.serialization.Model): that is, the property does not accept false as its value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault 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 094ee8b310b6..dfe858a24401 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,8 +16,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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 Operations(object): """Operations operations. @@ -45,29 +49,30 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -98,4 +103,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore 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 90441cce4390..33bcd4398041 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -18,8 +18,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. @@ -60,17 +64,18 @@ def create_or_update( :param parameters: Parameters to create or update the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_or_update.metadata['url'] + url = self.create_or_update.metadata['url'] # type: ignore 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}$'), @@ -108,10 +113,10 @@ def create_or_update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update( self, @@ -130,17 +135,18 @@ def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault or ~azure.mgmt.keyvault.v2016_10_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -178,10 +184,10 @@ def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def delete( self, @@ -197,16 +203,17 @@ def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -231,9 +238,9 @@ def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def get( self, @@ -249,16 +256,17 @@ def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -286,10 +294,10 @@ def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update_access_policy( self, @@ -311,17 +319,18 @@ def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -360,10 +369,10 @@ def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, @@ -371,7 +380,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.VaultListResult" + # type: (...) -> Iterable["models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,32 +388,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -435,44 +445,45 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -503,39 +514,40 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -566,7 +578,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore def get_deleted( self, @@ -582,16 +594,17 @@ def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -619,10 +632,10 @@ def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore def _purge_deleted_initial( self, @@ -632,11 +645,12 @@ def _purge_deleted_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -661,9 +675,9 @@ def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def begin_purge_deleted( self, @@ -671,7 +685,7 @@ def begin_purge_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -682,13 +696,17 @@ def begin_purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :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) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -696,58 +714,58 @@ def begin_purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2016-10-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -778,7 +796,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore def check_name_availability( self, @@ -791,17 +809,18 @@ def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2016_10_01.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2016-10-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -832,7 +851,7 @@ def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py index f54ed88d6ad2..1f618cc50426 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py @@ -8,3 +8,9 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py index 6c5cb5210b86..7695ad3f9ed0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py @@ -6,11 +6,17 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,7 +26,7 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ @@ -42,6 +48,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-02-14" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) 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 fd8afeb1997a..5ec92f953da4 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 @@ -6,11 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations from .operations import PrivateEndpointConnectionsOperations @@ -31,10 +37,11 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2018_02_14.operations.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( 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 03db2f1496d9..d63b2ce80ffe 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 @@ -4,31 +4,44 @@ "client": { "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", - "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "has_subscription_id": true + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault." }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "package_version": false, - "global_parameters": { - "method": { - "credential": { - "method_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", - "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 - } + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true }, - "constant": { + "subscription_id": { + "method_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 } - } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] }, "operation_groups": { "vaults": "VaultsOperations", @@ -37,5 +50,7 @@ "operations": "Operations" }, "operation_mixins": { - } + }, + "sync_imports": "None", + "async_imports": "None" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py index 7fb48477d0ba..de60602281eb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py @@ -6,11 +6,15 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,14 +24,14 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any ) -> None: @@ -41,6 +45,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2018-02-14" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py index ce8ac6a6eec8..d60ca750a58b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py @@ -6,11 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + from ._configuration_async import KeyVaultManagementClientConfiguration from .operations_async import VaultsOperations from .operations_async import PrivateEndpointConnectionsOperations @@ -31,15 +35,16 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py index 02ba4b52b997..6242c4e6289a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -44,29 +44,30 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -97,4 +98,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py index 102f9b9b8f88..47347aca2741 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -59,16 +59,17 @@ async def get( with the key vault. :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) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get.metadata['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'), @@ -97,10 +98,10 @@ async def get( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def put( self, @@ -122,17 +123,18 @@ async def put( :param properties: The intended state of private endpoint connection. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.put.metadata['url'] + url = self.put.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'), @@ -169,10 +171,10 @@ async def put( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( self, @@ -182,11 +184,12 @@ async def _delete_initial( **kwargs ) -> "models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.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'), @@ -222,10 +225,10 @@ async def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def delete( self, @@ -247,13 +250,17 @@ async def delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns PrivateEndpointConnection - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -262,6 +269,9 @@ async def delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -269,12 +279,8 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py index 4f87c4b07ef3..f15e06765d74 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py @@ -53,16 +53,17 @@ async def list_by_vault( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) + :return: PrivateLinkResourceListResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.list_by_vault.metadata['url'] + url = self.list_by_vault.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'), @@ -90,7 +91,7 @@ async def list_by_vault( deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py index 5d521b0958cb..9bf92629bfdb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -51,12 +51,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore 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}$'), @@ -94,10 +95,10 @@ async def _create_or_update_initial( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def create_or_update( self, @@ -118,13 +119,17 @@ async def create_or_update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns Vault - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -133,6 +138,9 @@ async def create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('Vault', pipeline_response) @@ -140,15 +148,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update( self, @@ -166,17 +170,18 @@ async def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -214,10 +219,10 @@ async def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def delete( self, @@ -232,16 +237,17 @@ async def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -266,9 +272,9 @@ async def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def get( self, @@ -283,16 +289,17 @@ async def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -320,10 +327,10 @@ async def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update_access_policy( self, @@ -344,17 +351,18 @@ async def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -393,17 +401,17 @@ async def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> "models.VaultListResult": + ) -> AsyncIterable["models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -411,32 +419,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -467,43 +476,44 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -534,38 +544,39 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs - ) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -596,7 +607,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore async def get_deleted( self, @@ -611,16 +622,17 @@ async def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -648,10 +660,10 @@ async def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore async def _purge_deleted_initial( self, @@ -660,11 +672,12 @@ async def _purge_deleted_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -689,9 +702,9 @@ async def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore async def purge_deleted( self, @@ -709,13 +722,17 @@ async def purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: None, or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -723,57 +740,57 @@ async def purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -804,7 +821,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore async def check_name_availability( self, @@ -816,17 +833,18 @@ async def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -857,7 +875,7 @@ async def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py index 36f822d150c2..296505d1a453 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py @@ -8,35 +8,11 @@ from enum import Enum -class KeyPermissions(str, Enum): - - encrypt = "encrypt" - decrypt = "decrypt" - wrap_key = "wrapKey" - unwrap_key = "unwrapKey" - sign = "sign" - verify = "verify" - get = "get" - list = "list" - create = "create" - update = "update" - import_enum = "import" - delete = "delete" - backup = "backup" - restore = "restore" - recover = "recover" - purge = "purge" - -class SecretPermissions(str, Enum): +class AccessPolicyUpdateKind(str, Enum): - get = "get" - list = "list" - set = "set" - delete = "delete" - backup = "backup" - restore = "restore" - recover = "recover" - purge = "purge" + add = "add" + replace = "replace" + remove = "remove" class CertificatePermissions(str, Enum): @@ -57,31 +33,47 @@ class CertificatePermissions(str, Enum): backup = "backup" restore = "restore" -class StoragePermissions(str, Enum): +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + recover = "recover" + default = "default" + +class KeyPermissions(str, Enum): + + encrypt = "encrypt" + decrypt = "decrypt" + wrap_key = "wrapKey" + unwrap_key = "unwrapKey" + sign = "sign" + verify = "verify" get = "get" list = "list" - delete = "delete" - set = "set" + create = "create" update = "update" - regeneratekey = "regeneratekey" - recover = "recover" - purge = "purge" + import_enum = "import" + delete = "delete" backup = "backup" restore = "restore" - setsas = "setsas" - listsas = "listsas" - getsas = "getsas" - deletesas = "deletesas" + recover = "recover" + purge = "purge" -class PrivateEndpointServiceConnectionStatus(str, Enum): - """The private endpoint connection status. +class NetworkRuleAction(str, Enum): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. """ - pending = "Pending" - approved = "Approved" - rejected = "Rejected" - disconnected = "Disconnected" + allow = "Allow" + deny = "Deny" + +class NetworkRuleBypassOptions(str, Enum): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + azure_services = "AzureServices" + none = "None" class PrivateEndpointConnectionProvisioningState(str, Enum): """The current provisioning state. @@ -94,35 +86,14 @@ class PrivateEndpointConnectionProvisioningState(str, Enum): failed = "Failed" disconnected = "Disconnected" -class SkuName(str, Enum): - """SKU name to specify whether the key vault is a standard vault or a premium vault. - """ - - standard = "standard" - premium = "premium" - -class CreateMode(str, Enum): - """The vault's create mode to indicate whether the vault need to be recovered or not. - """ - - recover = "recover" - default = "default" - -class NetworkRuleBypassOptions(str, Enum): - """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not - specified the default is 'AzureServices'. - """ - - azure_services = "AzureServices" - none = "None" - -class NetworkRuleAction(str, Enum): - """The default action when no rule from ipRules and from virtualNetworkRules match. This is only - used after the bypass property has been evaluated. +class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. """ - allow = "Allow" - deny = "Deny" + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" class Reason(str, Enum): """The reason that a vault name could not be used. The Reason element is only returned if @@ -132,8 +103,37 @@ class Reason(str, Enum): account_name_invalid = "AccountNameInvalid" already_exists = "AlreadyExists" -class AccessPolicyUpdateKind(str, Enum): +class SecretPermissions(str, Enum): - add = "add" - replace = "replace" - remove = "remove" + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class StoragePermissions(str, Enum): + + get = "get" + list = "list" + delete = "delete" + set = "set" + update = "update" + regeneratekey = "regeneratekey" + recover = "recover" + purge = "purge" + backup = "backup" + restore = "restore" + setsas = "setsas" + listsas = "listsas" + getsas = "getsas" + deletesas = "deletesas" 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 92f4f3061a50..57ae92ca1dc0 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 @@ -45,10 +45,10 @@ def __init__( **kwargs ): super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.object_id = kwargs.get('object_id', None) + self.tenant_id = kwargs['tenant_id'] + self.object_id = kwargs['object_id'] self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs.get('permissions', None) + self.permissions = kwargs['permissions'] class CheckNameAvailabilityResult(msrest.serialization.Model): @@ -61,8 +61,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2018_02_14.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -244,7 +244,7 @@ def __init__( **kwargs ): super(IPRule, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] class LogSpecification(msrest.serialization.Model): @@ -279,11 +279,11 @@ class NetworkRuleSet(msrest.serialization.Model): :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: - 'AzureServices', 'None'. + "AzureServices", "None". :type bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions :param default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: 'Allow', 'Deny'. + Possible values include: "Allow", "Deny". :type default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] @@ -516,7 +516,7 @@ class PrivateEndpointConnection(Resource): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -562,7 +562,7 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -664,7 +664,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". :type status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. @@ -742,7 +742,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ @@ -763,7 +763,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class Vault(msrest.serialization.Model): @@ -813,7 +813,7 @@ def __init__( self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyParameters(msrest.serialization.Model): @@ -860,7 +860,7 @@ def __init__( self.name = None self.type = None self.location = None - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyProperties(msrest.serialization.Model): @@ -886,7 +886,7 @@ def __init__( **kwargs ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs.get('access_policies', None) + self.access_policies = kwargs['access_policies'] class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -920,7 +920,7 @@ def __init__( **kwargs ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class VaultCreateOrUpdateParameters(msrest.serialization.Model): @@ -952,9 +952,9 @@ def __init__( **kwargs ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultListResult(msrest.serialization.Model): @@ -1027,7 +1027,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1102,7 +1102,7 @@ class VaultProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1145,8 +1145,8 @@ def __init__( **kwargs ): super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) + self.tenant_id = kwargs['tenant_id'] + self.sku = kwargs['sku'] self.access_policies = kwargs.get('access_policies', None) self.vault_uri = kwargs.get('vault_uri', None) self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) @@ -1183,4 +1183,4 @@ def __init__( **kwargs ): super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + self.id = kwargs['id'] 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 6280744ec48d..9e28a6306f92 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 @@ -10,6 +10,8 @@ import msrest.serialization +from ._key_vault_management_client_enums import * + class AccessPolicyEntry(msrest.serialization.Model): """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. @@ -68,8 +70,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2018_02_14.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -300,11 +302,11 @@ class NetworkRuleSet(msrest.serialization.Model): :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: - 'AzureServices', 'None'. + "AzureServices", "None". :type bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions :param default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: 'Allow', 'Deny'. + Possible values include: "Allow", "Deny". :type default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] @@ -560,7 +562,7 @@ class PrivateEndpointConnection(Resource): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -609,7 +611,7 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -718,7 +720,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". :type status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. @@ -805,7 +807,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ @@ -1112,7 +1114,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1198,7 +1200,7 @@ class VaultProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :type enable_soft_delete: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault 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 eab5bb884192..e9d5d41a4e46 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,8 +16,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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 Operations(object): """Operations operations. @@ -45,29 +49,30 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -98,4 +103,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore 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 dca98975a92a..0a756de5171a 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,8 +17,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -60,16 +64,17 @@ def get( with the key vault. :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) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get.metadata['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'), @@ -98,10 +103,10 @@ def get( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def put( self, @@ -124,17 +129,18 @@ def put( :param properties: The intended state of private endpoint connection. :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.put.metadata['url'] + url = self.put.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'), @@ -171,10 +177,10 @@ def put( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, @@ -185,11 +191,12 @@ def _delete_initial( ): # type: (...) -> "models.PrivateEndpointConnection" cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.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'), @@ -225,10 +232,10 @@ def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def begin_delete( self, @@ -237,7 +244,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> LROPoller """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. @@ -251,13 +258,17 @@ def begin_delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns PrivateEndpointConnection + :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) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -266,6 +277,9 @@ def begin_delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -273,12 +287,8 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 801b3323c22c..303bace6fdc3 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,8 +15,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -54,16 +58,17 @@ def list_by_vault( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) + :return: PrivateLinkResourceListResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.list_by_vault.metadata['url'] + url = self.list_by_vault.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'), @@ -91,7 +96,7 @@ def list_by_vault( deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore 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 458c4adbd67b..7287314e7a41 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -18,8 +18,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. @@ -52,12 +56,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Vault" cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore 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}$'), @@ -95,10 +100,10 @@ def _create_or_update_initial( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def begin_create_or_update( self, @@ -107,7 +112,7 @@ def begin_create_or_update( parameters, # type: "models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> LROPoller """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. @@ -120,13 +125,17 @@ def begin_create_or_update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns Vault + :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) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -135,6 +144,9 @@ def begin_create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('Vault', pipeline_response) @@ -142,15 +154,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update( self, @@ -169,17 +177,18 @@ def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault or ~azure.mgmt.keyvault.v2018_02_14.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -217,10 +226,10 @@ def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def delete( self, @@ -236,16 +245,17 @@ def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -270,9 +280,9 @@ def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def get( self, @@ -288,16 +298,17 @@ def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -325,10 +336,10 @@ def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update_access_policy( self, @@ -350,17 +361,18 @@ def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -399,10 +411,10 @@ def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, @@ -410,7 +422,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.VaultListResult" + # type: (...) -> Iterable["models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -418,32 +430,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -474,44 +487,45 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -542,39 +556,40 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -605,7 +620,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore def get_deleted( self, @@ -621,16 +636,17 @@ def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -658,10 +674,10 @@ def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore def _purge_deleted_initial( self, @@ -671,11 +687,12 @@ def _purge_deleted_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -700,9 +717,9 @@ def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def begin_purge_deleted( self, @@ -710,7 +727,7 @@ def begin_purge_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -721,13 +738,17 @@ def begin_purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :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) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -735,58 +756,58 @@ def begin_purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2018-02-14" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -817,7 +838,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore def check_name_availability( self, @@ -830,17 +851,18 @@ def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2018-02-14" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -871,7 +893,7 @@ def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py index f54ed88d6ad2..1f618cc50426 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py @@ -8,3 +8,9 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +try: + from ._patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py index 3360b32c73ad..f94da1f835aa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py @@ -6,11 +6,17 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,7 +26,7 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ @@ -42,6 +48,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-09-01" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) 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 0041afc8cd10..002dd4926bf8 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 @@ -6,11 +6,17 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import TYPE_CHECKING from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from ._configuration import KeyVaultManagementClientConfiguration from .operations import VaultsOperations from .operations import PrivateEndpointConnectionsOperations @@ -31,10 +37,11 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( 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 d42666b92413..707414eac945 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 @@ -4,31 +4,44 @@ "client": { "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", - "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "has_subscription_id": true + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault." }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "package_version": false, - "global_parameters": { - "method": { - "credential": { - "method_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", - "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 - } + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true }, - "constant": { + "subscription_id": { + "method_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 } - } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] }, "operation_groups": { "vaults": "VaultsOperations", @@ -37,5 +50,7 @@ "operations": "Operations" }, "operation_mixins": { - } + }, + "sync_imports": "None", + "async_imports": "None" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py index 8fdd52022b94..dd4d7f9a309e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py @@ -6,11 +6,15 @@ # 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 +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + VERSION = "unknown" class KeyVaultManagementClientConfiguration(Configuration): @@ -20,14 +24,14 @@ class KeyVaultManagementClientConfiguration(Configuration): attributes. :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any ) -> None: @@ -41,6 +45,7 @@ def __init__( self.subscription_id = subscription_id self.api_version = "2019-09-01" self.credential_scopes = ['https://management.azure.com/.default'] + self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py index 864b69abe5a6..2a79eafb034c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py @@ -6,11 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional +from typing import Any, Optional, TYPE_CHECKING from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + from ._configuration_async import KeyVaultManagementClientConfiguration from .operations_async import VaultsOperations from .operations_async import PrivateEndpointConnectionsOperations @@ -31,15 +35,16 @@ class KeyVaultManagementClient(object): :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.Operations :param credential: Credential needed for the client to connect to Azure. - :type credential: azure.core.credentials.TokenCredential + :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 base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( self, - credential: "TokenCredential", + credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py index 5248f4e61907..a07488230478 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -44,29 +44,30 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -97,4 +98,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py index 134b81c4847a..52087e4b0ca0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -59,16 +59,17 @@ async def get( with the key vault. :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) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get.metadata['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'), @@ -97,10 +98,10 @@ async def get( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def put( self, @@ -122,17 +123,18 @@ async def put( :param properties: The intended state of private endpoint connection. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.put.metadata['url'] + url = self.put.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'), @@ -169,10 +171,10 @@ async def put( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( self, @@ -182,11 +184,12 @@ async def _delete_initial( **kwargs ) -> "models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.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'), @@ -222,10 +225,10 @@ async def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def delete( self, @@ -247,13 +250,17 @@ async def delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns PrivateEndpointConnection - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -262,6 +269,9 @@ async def delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -269,12 +279,8 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py index 172fd9e9155b..74957bed8692 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py @@ -53,16 +53,17 @@ async def list_by_vault( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) + :return: PrivateLinkResourceListResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.list_by_vault.metadata['url'] + url = self.list_by_vault.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'), @@ -90,7 +91,7 @@ async def list_by_vault( deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py index d94d26bce836..1935a7ee3818 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -51,12 +51,13 @@ async def _create_or_update_initial( **kwargs ) -> "models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore 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}$'), @@ -94,10 +95,10 @@ async def _create_or_update_initial( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def create_or_update( self, @@ -118,13 +119,17 @@ async def create_or_update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns Vault - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -133,6 +138,9 @@ async def create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('Vault', pipeline_response) @@ -140,15 +148,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update( self, @@ -166,17 +170,18 @@ async def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -214,10 +219,10 @@ async def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def delete( self, @@ -232,16 +237,17 @@ async def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -266,9 +272,9 @@ async def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def get( self, @@ -283,16 +289,17 @@ async def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -320,10 +327,10 @@ async def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update_access_policy( self, @@ -344,17 +351,18 @@ async def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -393,17 +401,17 @@ async def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> "models.VaultListResult": + ) -> AsyncIterable["models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -411,32 +419,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -467,43 +476,44 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -534,38 +544,39 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs - ) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -596,7 +607,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore async def get_deleted( self, @@ -611,16 +622,17 @@ async def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -648,10 +660,10 @@ async def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore async def _purge_deleted_initial( self, @@ -660,11 +672,12 @@ async def _purge_deleted_initial( **kwargs ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -689,9 +702,9 @@ async def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore async def purge_deleted( self, @@ -709,13 +722,17 @@ async def purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :return: An instance of LROPoller that returns None - :rtype: ~azure.core.polling.LROPoller[None] - + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: None, or the result of cls(response) + :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = await self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -723,57 +740,57 @@ async def purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top: Optional[int] = None, **kwargs - ) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -804,7 +821,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore async def check_name_availability( self, @@ -816,17 +833,18 @@ async def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -857,7 +875,7 @@ async def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore 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 36f822d150c2..296505d1a453 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 @@ -8,35 +8,11 @@ from enum import Enum -class KeyPermissions(str, Enum): - - encrypt = "encrypt" - decrypt = "decrypt" - wrap_key = "wrapKey" - unwrap_key = "unwrapKey" - sign = "sign" - verify = "verify" - get = "get" - list = "list" - create = "create" - update = "update" - import_enum = "import" - delete = "delete" - backup = "backup" - restore = "restore" - recover = "recover" - purge = "purge" - -class SecretPermissions(str, Enum): +class AccessPolicyUpdateKind(str, Enum): - get = "get" - list = "list" - set = "set" - delete = "delete" - backup = "backup" - restore = "restore" - recover = "recover" - purge = "purge" + add = "add" + replace = "replace" + remove = "remove" class CertificatePermissions(str, Enum): @@ -57,31 +33,47 @@ class CertificatePermissions(str, Enum): backup = "backup" restore = "restore" -class StoragePermissions(str, Enum): +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + recover = "recover" + default = "default" + +class KeyPermissions(str, Enum): + + encrypt = "encrypt" + decrypt = "decrypt" + wrap_key = "wrapKey" + unwrap_key = "unwrapKey" + sign = "sign" + verify = "verify" get = "get" list = "list" - delete = "delete" - set = "set" + create = "create" update = "update" - regeneratekey = "regeneratekey" - recover = "recover" - purge = "purge" + import_enum = "import" + delete = "delete" backup = "backup" restore = "restore" - setsas = "setsas" - listsas = "listsas" - getsas = "getsas" - deletesas = "deletesas" + recover = "recover" + purge = "purge" -class PrivateEndpointServiceConnectionStatus(str, Enum): - """The private endpoint connection status. +class NetworkRuleAction(str, Enum): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. """ - pending = "Pending" - approved = "Approved" - rejected = "Rejected" - disconnected = "Disconnected" + allow = "Allow" + deny = "Deny" + +class NetworkRuleBypassOptions(str, Enum): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + azure_services = "AzureServices" + none = "None" class PrivateEndpointConnectionProvisioningState(str, Enum): """The current provisioning state. @@ -94,35 +86,14 @@ class PrivateEndpointConnectionProvisioningState(str, Enum): failed = "Failed" disconnected = "Disconnected" -class SkuName(str, Enum): - """SKU name to specify whether the key vault is a standard vault or a premium vault. - """ - - standard = "standard" - premium = "premium" - -class CreateMode(str, Enum): - """The vault's create mode to indicate whether the vault need to be recovered or not. - """ - - recover = "recover" - default = "default" - -class NetworkRuleBypassOptions(str, Enum): - """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not - specified the default is 'AzureServices'. - """ - - azure_services = "AzureServices" - none = "None" - -class NetworkRuleAction(str, Enum): - """The default action when no rule from ipRules and from virtualNetworkRules match. This is only - used after the bypass property has been evaluated. +class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. """ - allow = "Allow" - deny = "Deny" + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" class Reason(str, Enum): """The reason that a vault name could not be used. The Reason element is only returned if @@ -132,8 +103,37 @@ class Reason(str, Enum): account_name_invalid = "AccountNameInvalid" already_exists = "AlreadyExists" -class AccessPolicyUpdateKind(str, Enum): +class SecretPermissions(str, Enum): - add = "add" - replace = "replace" - remove = "remove" + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class StoragePermissions(str, Enum): + + get = "get" + list = "list" + delete = "delete" + set = "set" + update = "update" + regeneratekey = "regeneratekey" + recover = "recover" + purge = "purge" + backup = "backup" + restore = "restore" + setsas = "setsas" + listsas = "listsas" + getsas = "getsas" + deletesas = "deletesas" 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 d0b0e54a7b1a..ced2c10c856a 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 @@ -45,10 +45,10 @@ def __init__( **kwargs ): super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.object_id = kwargs.get('object_id', None) + self.tenant_id = kwargs['tenant_id'] + self.object_id = kwargs['object_id'] self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs.get('permissions', None) + self.permissions = kwargs['permissions'] class CheckNameAvailabilityResult(msrest.serialization.Model): @@ -61,8 +61,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2019_09_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -244,7 +244,7 @@ def __init__( **kwargs ): super(IPRule, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] class LogSpecification(msrest.serialization.Model): @@ -279,11 +279,11 @@ class NetworkRuleSet(msrest.serialization.Model): :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: - 'AzureServices', 'None'. + "AzureServices", "None". :type bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions :param default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: 'Allow', 'Deny'. + Possible values include: "Allow", "Deny". :type default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] @@ -516,7 +516,7 @@ class PrivateEndpointConnection(Resource): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -562,7 +562,7 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -664,7 +664,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". :type status: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. @@ -742,7 +742,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ @@ -763,7 +763,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class Vault(msrest.serialization.Model): @@ -813,7 +813,7 @@ def __init__( self.type = None self.location = kwargs.get('location', None) self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyParameters(msrest.serialization.Model): @@ -860,7 +860,7 @@ def __init__( self.name = None self.type = None self.location = None - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultAccessPolicyProperties(msrest.serialization.Model): @@ -886,7 +886,7 @@ def __init__( **kwargs ): super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs.get('access_policies', None) + self.access_policies = kwargs['access_policies'] class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): @@ -920,7 +920,7 @@ def __init__( **kwargs ): super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) + self.name = kwargs['name'] class VaultCreateOrUpdateParameters(msrest.serialization.Model): @@ -952,9 +952,9 @@ def __init__( **kwargs ): super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs.get('location', None) + self.location = kwargs['location'] self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) + self.properties = kwargs['properties'] class VaultListResult(msrest.serialization.Model): @@ -1036,7 +1036,7 @@ class VaultPatchProperties(msrest.serialization.Model): :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1126,7 +1126,7 @@ class VaultProperties(msrest.serialization.Model): actions are always authorized with RBAC. :type enable_rbac_authorization: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1171,8 +1171,8 @@ def __init__( **kwargs ): super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) + self.tenant_id = kwargs['tenant_id'] + self.sku = kwargs['sku'] self.access_policies = kwargs.get('access_policies', None) self.vault_uri = kwargs.get('vault_uri', None) self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) @@ -1211,4 +1211,4 @@ def __init__( **kwargs ): super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs.get('id', None) + self.id = kwargs['id'] 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 ac0939307869..278d21ba1c4c 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 @@ -10,6 +10,8 @@ import msrest.serialization +from ._key_vault_management_client_enums import * + class AccessPolicyEntry(msrest.serialization.Model): """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. @@ -68,8 +70,8 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', - 'AlreadyExists'. + returned if NameAvailable is false. Possible values include: "AccountNameInvalid", + "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2019_09_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -300,11 +302,11 @@ class NetworkRuleSet(msrest.serialization.Model): :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: - 'AzureServices', 'None'. + "AzureServices", "None". :type bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions :param default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: 'Allow', 'Deny'. + Possible values include: "Allow", "Deny". :type default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :param ip_rules: The list of IP address rules. :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] @@ -560,7 +562,7 @@ class PrivateEndpointConnection(Resource): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -609,7 +611,7 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: 'Succeeded', 'Creating', 'Updating', 'Deleting', 'Failed', 'Disconnected'. + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -718,7 +720,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: 'Pending', 'Approved', 'Rejected', 'Disconnected'. + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". :type status: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. @@ -805,7 +807,7 @@ class Sku(msrest.serialization.Model): :ivar family: Required. SKU family name. Default value: "A". :vartype family: str :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: 'standard', 'premium'. + premium vault. Possible values include: "standard", "premium". :type name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ @@ -1121,7 +1123,7 @@ class VaultPatchProperties(msrest.serialization.Model): :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :type soft_delete_retention_in_days: int :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1224,7 +1226,7 @@ class VaultProperties(msrest.serialization.Model): actions are always authorized with RBAC. :type enable_rbac_authorization: bool :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: 'recover', 'default'. + or not. Possible values include: "recover", "default". :type create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :param enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault 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 56c0f275f327..7f961d399970 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,8 +16,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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 Operations(object): """Operations operations. @@ -45,29 +49,30 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -98,4 +103,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore 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 2c1e28e497f4..aa3de97c0708 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -17,8 +17,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -60,16 +64,17 @@ def get( with the key vault. :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) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get.metadata['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'), @@ -98,10 +103,10 @@ def get( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def put( self, @@ -124,17 +129,18 @@ def put( :param properties: The intended state of private endpoint connection. :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateEndpointConnection or the result of cls(response) + :return: PrivateEndpointConnection, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.put.metadata['url'] + url = self.put.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'), @@ -171,10 +177,10 @@ def put( deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, @@ -185,11 +191,12 @@ def _delete_initial( ): # type: (...) -> "models.PrivateEndpointConnection" cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self._delete_initial.metadata['url'] + url = self._delete_initial.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'), @@ -225,10 +232,10 @@ def _delete_initial( response_headers['Location']=self._deserialize('str', response.headers.get('Location')) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) return deserialized - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def begin_delete( self, @@ -237,7 +244,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> LROPoller """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. @@ -251,13 +258,17 @@ def begin_delete( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns PrivateEndpointConnection + :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) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._delete_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -266,6 +277,9 @@ def begin_delete( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) @@ -273,12 +287,8 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 4578a5326af5..f7874435bd23 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,8 +15,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -54,16 +58,17 @@ def list_by_vault( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: PrivateLinkResourceListResult or the result of cls(response) + :return: PrivateLinkResourceListResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.list_by_vault.metadata['url'] + url = self.list_by_vault.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'), @@ -91,7 +96,7 @@ def list_by_vault( deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore 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 fb64dc1f79d0..db2f3d39ed9f 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 @@ -5,7 +5,7 @@ # 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, Callable, Dict, Generic, Optional, TypeVar, Union +from typing import TYPE_CHECKING import warnings from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -18,8 +18,12 @@ from .. import models -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations(object): """VaultsOperations operations. @@ -52,12 +56,13 @@ def _create_or_update_initial( ): # type: (...) -> "models.Vault" cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self._create_or_update_initial.metadata['url'] + url = self._create_or_update_initial.metadata['url'] # type: ignore 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}$'), @@ -95,10 +100,10 @@ def _create_or_update_initial( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def begin_create_or_update( self, @@ -107,7 +112,7 @@ def begin_create_or_update( parameters, # type: "models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> LROPoller """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. @@ -120,13 +125,17 @@ def begin_create_or_update( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns Vault + :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) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, @@ -135,6 +144,9 @@ def begin_create_or_update( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): deserialized = self._deserialize('Vault', pipeline_response) @@ -142,15 +154,11 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update( self, @@ -169,17 +177,18 @@ def update( :param parameters: Parameters to patch the vault. :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault or ~azure.mgmt.keyvault.v2019_09_01.models.Vault + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update.metadata['url'] + url = self.update.metadata['url'] # type: ignore 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}$'), @@ -217,10 +226,10 @@ def update( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def delete( self, @@ -236,16 +245,17 @@ def delete( :param vault_name: The name of the vault to delete. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) + :return: None, or the result of cls(response) :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.delete.metadata['url'] + url = self.delete.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -270,9 +280,9 @@ def delete( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def get( self, @@ -288,16 +298,17 @@ def get( :param vault_name: The name of the vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault or the result of cls(response) + :return: Vault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get.metadata['url'] + url = self.get.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), @@ -325,10 +336,10 @@ def get( deserialized = self._deserialize('Vault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update_access_policy( self, @@ -350,17 +361,18 @@ def update_access_policy( :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultAccessPolicyParameters or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters or ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_access_policy.metadata['url'] + url = self.update_access_policy.metadata['url'] # type: ignore 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}$'), @@ -399,10 +411,10 @@ def update_access_policy( deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore def list_by_resource_group( self, @@ -410,7 +422,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "models.VaultListResult" + # type: (...) -> Iterable["models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -418,32 +430,33 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_resource_group.metadata['url'] + url = self.list_by_resource_group.metadata['url'] # type: ignore path_format_arguments = { 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -474,44 +487,45 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_by_subscription( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: VaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_by_subscription.metadata['url'] + url = self.list_by_subscription.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -542,39 +556,40 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> "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 - :return: DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult + :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list_deleted.metadata['url'] + url = self.list_deleted.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -605,7 +620,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore def get_deleted( self, @@ -621,16 +636,17 @@ def get_deleted( :param location: The location of the deleted vault. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: DeletedVault or the result of cls(response) + :return: DeletedVault, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self.get_deleted.metadata['url'] + url = self.get_deleted.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -658,10 +674,10 @@ def get_deleted( deserialized = self._deserialize('DeletedVault', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore def _purge_deleted_initial( self, @@ -671,11 +687,12 @@ def _purge_deleted_initial( ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" # Construct URL - url = self._purge_deleted_initial.metadata['url'] + url = self._purge_deleted_initial.metadata['url'] # type: ignore path_format_arguments = { 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), 'location': self._serialize.url("location", location, 'str'), @@ -700,9 +717,9 @@ def _purge_deleted_initial( raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) - _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def begin_purge_deleted( self, @@ -710,7 +727,7 @@ def begin_purge_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> None + # type: (...) -> LROPoller """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -721,13 +738,17 @@ def begin_purge_deleted( :keyword polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy :paramtype polling: bool or ~azure.core.polling.PollingMethod - :return: An instance of LROPoller that returns None + :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) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) raw_result = self._purge_deleted_initial( vault_name=vault_name, location=location, @@ -735,58 +756,58 @@ def begin_purge_deleted( **kwargs ) + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - lro_delay = kwargs.get( - 'polling_interval', - self._config.polling_interval - ) if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> "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. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceListResult or the result of cls(response) - :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :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"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) filter = "resourceType eq 'Microsoft.KeyVault/vaults'" api_version = "2019-09-01" def prepare_request(next_link=None): if not next_link: # Construct URL - url = self.list.metadata['url'] + url = self.list.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + else: url = next_link - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - + query_parameters = {} # type: Dict[str, Any] # Construct headers header_parameters = {} # type: Dict[str, Any] header_parameters['Accept'] = 'application/json' @@ -817,7 +838,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore def check_name_availability( self, @@ -830,17 +851,18 @@ def check_name_availability( :param vault_name: The name of the vault. :type vault_name: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response - :return: CheckNameAvailabilityResult or the result of cls(response) + :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] - error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.check_name_availability.metadata['url'] + url = self.check_name_availability.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), } @@ -871,7 +893,7 @@ def check_name_availability( deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore From fae226647e4e2219d5efb1fa4115fe25a5835771 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 29 May 2020 09:38:44 +0200 Subject: [PATCH 3/9] 5.1.0-preview.1 --- .../_vaults_operations_async.py | 34 ++++++---- .../operations/_vaults_operations.py | 28 +++++--- ...e_endpoint_connections_operations_async.py | 33 ++++++---- .../_vaults_operations_async.py | 65 +++++++++++++------ ...private_endpoint_connections_operations.py | 27 +++++--- .../operations/_vaults_operations.py | 55 +++++++++++----- ...e_endpoint_connections_operations_async.py | 33 ++++++---- .../_vaults_operations_async.py | 65 +++++++++++++------ ...private_endpoint_connections_operations.py | 27 +++++--- .../operations/_vaults_operations.py | 55 +++++++++++----- 10 files changed, 291 insertions(+), 131 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py index c92eb0b5a807..1f725751d290 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -371,7 +371,8 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs ) -> AsyncIterable["models.VaultListResult"]: - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -665,7 +666,7 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore - async def purge_deleted( + async def begin_purge_deleted( self, vault_name: str, location: str, @@ -678,6 +679,7 @@ async def purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -692,12 +694,14 @@ async def purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = await self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -709,8 +713,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, 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 33bcd4398041..74854f5a895e 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 @@ -381,7 +381,8 @@ def list_by_resource_group( **kwargs # type: Any ): # type: (...) -> Iterable["models.VaultListResult"] - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -693,6 +694,7 @@ def begin_purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -707,12 +709,14 @@ def begin_purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -724,7 +728,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py index 47347aca2741..823750d8967c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -230,7 +230,7 @@ async def _delete_initial( return deserialized _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def delete( + async def begin_delete( self, resource_group_name: str, vault_name: str, @@ -247,6 +247,7 @@ async def delete( with the key vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -261,13 +262,15 @@ async def delete( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -282,5 +285,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py index 9bf92629bfdb..269f3da6038d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -100,7 +100,7 @@ async def _create_or_update_initial( return deserialized _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, vault_name: str, @@ -116,6 +116,7 @@ async def create_or_update( :param parameters: Parameters to create or update the vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -130,13 +131,15 @@ async def create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -151,8 +154,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update( self, @@ -412,7 +423,8 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs ) -> AsyncIterable["models.VaultListResult"]: - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -706,7 +718,7 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore - async def purge_deleted( + async def begin_purge_deleted( self, vault_name: str, location: str, @@ -719,6 +731,7 @@ async def purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -733,12 +746,14 @@ async def purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = await self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -750,8 +765,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, 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 0a756de5171a..b9eacb3ba092 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 @@ -255,6 +255,7 @@ def begin_delete( with the key vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -269,13 +270,15 @@ def begin_delete( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -290,5 +293,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 7287314e7a41..df8155ca7ce1 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 @@ -122,6 +122,7 @@ def begin_create_or_update( :param parameters: Parameters to create or update the vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -136,13 +137,15 @@ def begin_create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -157,7 +160,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update( @@ -423,7 +434,8 @@ def list_by_resource_group( **kwargs # type: Any ): # type: (...) -> Iterable["models.VaultListResult"] - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -735,6 +747,7 @@ def begin_purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -749,12 +762,14 @@ def begin_purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -766,7 +781,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py index 52087e4b0ca0..5441c5db5659 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -11,7 +11,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -230,7 +230,7 @@ async def _delete_initial( return deserialized _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def delete( + async def begin_delete( self, resource_group_name: str, vault_name: str, @@ -247,6 +247,7 @@ async def delete( with the key vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -261,13 +262,15 @@ async def delete( 'polling_interval', self._config.polling_interval ) - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -282,5 +285,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py index 1935a7ee3818..fc82562b634c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py @@ -12,7 +12,7 @@ from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -100,7 +100,7 @@ async def _create_or_update_initial( return deserialized _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore - async def create_or_update( + async def begin_create_or_update( self, resource_group_name: str, vault_name: str, @@ -116,6 +116,7 @@ async def create_or_update( :param parameters: Parameters to create or update the vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -130,13 +131,15 @@ async def create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -151,8 +154,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore async def update( self, @@ -412,7 +423,8 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs ) -> AsyncIterable["models.VaultListResult"]: - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -706,7 +718,7 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore - async def purge_deleted( + async def begin_purge_deleted( self, vault_name: str, location: str, @@ -719,6 +731,7 @@ async def purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod @@ -733,12 +746,14 @@ async def purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = await self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -750,8 +765,16 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling - return await async_poller(self._client, raw_result, get_long_running_output, polling_method) - purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( self, 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 aa3de97c0708..f4a731639511 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 @@ -255,6 +255,7 @@ def begin_delete( with the key vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -269,13 +270,15 @@ def begin_delete( 'polling_interval', self._config.polling_interval ) - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - private_endpoint_connection_name=private_endpoint_connection_name, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -290,5 +293,13 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 db2f3d39ed9f..f8d4ef58edbf 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 @@ -122,6 +122,7 @@ def begin_create_or_update( :param parameters: Parameters to create or update the vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -136,13 +137,15 @@ def begin_create_or_update( 'polling_interval', self._config.polling_interval ) - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - vault_name=vault_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -157,7 +160,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore def update( @@ -423,7 +434,8 @@ def list_by_resource_group( **kwargs # type: Any ): # type: (...) -> Iterable["models.VaultListResult"] - """The List operation gets information about the vaults associated with the subscription and within the specified resource group. + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. :param resource_group_name: The name of the Resource Group to which the vault belongs. :type resource_group_name: str @@ -735,6 +747,7 @@ def begin_purge_deleted( :param location: The location of the soft-deleted vault. :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 :paramtype polling: bool or ~azure.core.polling.PollingMethod @@ -749,12 +762,14 @@ def begin_purge_deleted( 'polling_interval', self._config.polling_interval ) - raw_result = self._purge_deleted_initial( - vault_name=vault_name, - location=location, - cls=lambda x,y,z: x, - **kwargs - ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) kwargs.pop('error_map', None) kwargs.pop('content_type', None) @@ -766,7 +781,15 @@ def get_long_running_output(pipeline_response): if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore def list( From 9377574c4179aae13a5fc3777bf12867aef1300f Mon Sep 17 00:00:00 2001 From: Kerwin Sun Date: Thu, 4 Jun 2020 18:03:37 +0800 Subject: [PATCH 4/9] [T2 aiotest] keyvault (#11646) * add aio test for keyvault * add .result for async poller --- .../tests/_aio_testcase.py | 33 + ...cli_mgmt_keyvault_async.test_keyvault.yaml | 826 ++++++++++++++++++ .../tests/test_cli_mgmt_keyvault_async.py | 321 +++++++ 3 files changed, 1180 insertions(+) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py b/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py new file mode 100644 index 000000000000..2ed8b31b3121 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py @@ -0,0 +1,33 @@ +import asyncio +from unittest.mock import Mock + +from azure.core.credentials import AccessToken +from azure.identity.aio import DefaultAzureCredential +from devtools_testutils import AzureMgmtTestCase + +class AzureMgmtAsyncTestCase(AzureMgmtTestCase): + + def setUp(self): + super(AzureMgmtAsyncTestCase, self).setUp() + + @property + def event_loop(self): + return asyncio.get_event_loop() + + def create_mgmt_aio_client(self, client, **kwargs): + if self.is_live: + credential = DefaultAzureCredential() + else: + credential = Mock(get_token=asyncio.coroutine(lambda _: AccessToken("fake-token", 0))) + return client( + credential=credential, + subscription_id=self.settings.SUBSCRIPTION_ID + ) + + def to_list(self, ait): + async def lst(): + result = [] + async for item in ait: + result.append(item) + return result + return self.event_loop.run_until_complete(lst()) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml new file mode 100644 index 000000000000..f2bd49578007 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml @@ -0,0 +1,826 @@ +interactions: +- request: + body: 'b''{"location": "eastus", "properties": {"tenantId": "00000000-0000-0000-0000-000000000000", + "sku": {"family": "A", "name": "standard"}, "accessPolicies": [{"tenantId": + "00000000-0000-0000-0000-000000000000", "objectId": "00000000-0000-0000-0000-000000000000", + "permissions": {"keys": ["encrypt", "decrypt", "wrapKey", "unwrapKey", "sign", + "verify", "get", "list", "create", "update", "import", "delete", "backup", "restore", + "recover", "purge"], "secrets": ["get", "list", "set", "delete", "backup", "restore", + "recover", "purge"], "certificates": ["get", "list", "delete", "create", "import", + "update", "managecontacts", "getissuers", "listissuers", "setissuers", "deleteissuers", + "manageissuers", "recover", "purge"]}}], "enabledForDeployment": true, "enabledForDiskEncryption": + true, "enabledForTemplateDeployment": true}}''' + headers: + Accept: + - application/json + Content-Length: + - '823' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxyzz.vault.azure.net","provisioningState":"RegisteringDns"}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:18 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-ms-ratelimit-remaining-subscription-writes: '1198' + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: null + headers: + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:51 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: 'b''{"properties": {"accessPolicies": [{"tenantId": "00000000-0000-0000-0000-000000000000", + "objectId": "00000000-0000-0000-0000-000000000000", "permissions": {"keys": + ["encrypt"], "secrets": ["get"], "certificates": ["get"]}}]}}''' + headers: + Accept: + - application/json + Content-Length: + - '225' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PUT + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:51 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-ms-ratelimit-remaining-subscription-writes: '1198' + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:52 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg=="}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:52 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== + response: + body: + string: '{"value":[]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:53 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/deletedVaults?api-version=2019-09-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/keyvaultxyzxxxxx","name":"keyvaultxyzxxxxx","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testgroupx/providers/Microsoft.KeyVault/vaults/keyvaultxyzxxxxx","location":"eastus","tags":{},"deletionDate":"2020-05-12T09:10:06Z","scheduledPurgeDate":"2020-08-10T09:10:06Z"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/keyvaultxyzxxxx","name":"keyvaultxyzxxxx","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testgroupx/providers/Microsoft.KeyVault/vaults/keyvaultxyzxxxx","location":"eastus","tags":{},"deletionDate":"2020-05-12T08:22:10Z","scheduledPurgeDate":"2020-08-10T08:22:10Z"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/westus/deletedVaults/pykvf9870e4e","name":"pykvf9870e4e","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_vaults_test_vaults_operationsf9870e4e/providers/Microsoft.KeyVault/vaults/pykvf9870e4e","location":"westus","tags":{},"deletionDate":"2020-03-18T09:43:53Z","scheduledPurgeDate":"2020-06-16T09:43:53Z"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/deletedVaults?api-version=2019-09-01&%24skiptoken=3ZDtaoMwGIXvJYz9mlWjXbVQhmAK22okaWJh%2f2yMrabVYuxXSu99YZcxOHA4cDgv7%2fMAnbyNq6ZTGswfACVrxtdgDvbjeNJz1z2WXbmTR9mNk9KcBzkR%2fdHV560WQ3Mam77TbgzreFpFtROI95kT%2bjB0Yl%2fMnEjU3kxU2xqGvnsa%2bktTyUG7WSOGXvf1OPmW96I8H0a3kgc5yuov6I%2fy1DgX27TjC%2bj5seNZ%2ba8vWtmLvZLdgqtiQ4svRjldMlTwNY%2fzFT%2fwOv30M7a7ZSa55yyBOeMGGwExwxHx%2bJW0Ksh5BjOW3HCaGGKUh5m6YkOXxHBIPJzmHIE3sEH%2fgYP9PcAtgrjlofU7Nj9RZsjVsgiwlxmaUoRTZGirLIvE2F5A0z2iKZ8SRcDz%2bQs%3d"}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '1045' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:55 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: 34023f30-fd9c-4561-ab54-ea8250813f02 + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/deletedVaults?api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/deletedVaults?api-version=2019-09-01&$skiptoken=3ZDtaoMwGIXvJYz9mlWjXbVQhmAK22okaWJh/2yMrabVYuxXSu99YZcxOHA4cDgv7/MAnbyNq6ZTGswfACVrxtdgDvbjeNJz1z2WXbmTR9mNk9KcBzkR/dHV560WQ3Mam77TbgzreFpFtROI95kT%2BjB0Yl/MnEjU3kxU2xqGvnsa%2BktTyUG7WSOGXvf1OPmW96I8H0a3kgc5yuov6I/y1DgX27TjC%2Bj5seNZ%2Ba8vWtmLvZLdgqtiQ4svRjldMlTwNY/zFT/wOv30M7a7ZSa55yyBOeMGGwExwxHx%2BJW0Ksh5BjOW3HCaGGKUh5m6YkOXxHBIPJzmHIE3sEH/gYP9PcAtgrjlofU7Nj9RZsjVsgiwlxmaUoRTZGirLIvE2F5A0z2iKZ8SRcDz%2BQs%3D + response: + body: + string: '{"value":[]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '133' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:55 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: 970fc52b-6668-4c03-968e-87d60145429a + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/deletedVaults?api-version=2019-09-01&$skiptoken=3ZDtaoMwGIXvJYz9mlWjXbVQhmAK22okaWJh/2yMrabVYuxXSu99YZcxOHA4cDgv7/MAnbyNq6ZTGswfACVrxtdgDvbjeNJz1z2WXbmTR9mNk9KcBzkR/dHV560WQ3Mam77TbgzreFpFtROI95kT%2BjB0Yl/MnEjU3kxU2xqGvnsa%2BktTyUG7WSOGXvf1OPmW96I8H0a3kgc5yuov6I/y1DgX27TjC%2Bj5seNZ%2Ba8vWtmLvZLdgqtiQ4svRjldMlTwNY/zFT/wOv30M7a7ZSa55yyBOeMGGwExwxHx%2BJW0Ksh5BjOW3HCaGGKUh5m6YkOXxHBIPJzmHIE3sEH/gYP9PcAtgrjlofU7Nj9RZsjVsgiwlxmaUoRTZGirLIvE2F5A0z2iKZ8SRcDz%2BQs%3D +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VHRbqMwEPwXVPWpBAwhCZHQqb2jtL1Cr0Aw%2bM3YphBsQNjJEar%2b%2b9H7ilbaWY1Gqx3N7rvWsUk9N10rtf275t8m6SHR9lqt1CD3hiFwh9%2bYYJ1a4fk0shXphSFPpSRjM6im76ThWpXr0F2l22Sz1dfAWusuIFt9RypzS2hZWWtgDGN%2fbigbpRE2ZOxlX6nVb3bJ8Ikr4%2fzZ5Y8r1Q8euMZDo5%2bXyWW5Z5nA1c2lwPWVbBfHvmWdR4NspvfusQx4VUKqFj6inFtFnsmF18TmpwK4JsojM7cUZzmqKZzMaCY2Sv0pstCuzDksFg0KPqIF7IFv2JvnaTfaTz9K49vnr38HZHEzFPSCYfw%2fK4ZOVwV0oL%2beOiJ4i%2b3iMw%2f0v8NTEzaeG8LusGT0JhXuCSVTGwO0QX7hhJwXWRe1ie8I5FPIRBy8pE8I3qMZ%2bfULEo%2fzq5iO5aH4W2TEoTC8wDT7EweRDXmclAF6fD1mdQgGlYK4C03wkKV3%2bJCarvbx8Q8%3d"}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '1823' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:56 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: ded3b3c4-1c3c-490d-b98c-0f6cbbdf3f81 + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=1VHRbqMwEPwXVPWpBAwhCZHQqb2jtL1Cr0Aw%2BM3YphBsQNjJEar%2B%2B9H7ilbaWY1Gqx3N7rvWsUk9N10rtf275t8m6SHR9lqt1CD3hiFwh9%2BYYJ1a4fk0shXphSFPpSRjM6im76ThWpXr0F2l22Sz1dfAWusuIFt9RypzS2hZWWtgDGN/bigbpRE2ZOxlX6nVb3bJ8Ikr4/zZ5Y8r1Q8euMZDo5%2BXyWW5Z5nA1c2lwPWVbBfHvmWdR4NspvfusQx4VUKqFj6inFtFnsmF18TmpwK4JsojM7cUZzmqKZzMaCY2Sv0pstCuzDksFg0KPqIF7IFv2JvnaTfaTz9K49vnr38HZHEzFPSCYfw/K4ZOVwV0oL%2BeOiJ4i%2B3iMw/0v8NTEzaeG8LusGT0JhXuCSVTGwO0QX7hhJwXWRe1ie8I5FPIRBy8pE8I3qMZ%2BfULEo/zq5iO5aH4W2TEoTC8wDT7EweRDXmclAF6fD1mdQgGlYK4C03wkKV3%2BJCarvbx8Q8%3D + response: + body: + string: '{"value":[]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '133' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:56 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: d23b735f-2642-4dad-9524-a2b042b5332a + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=1VHRbqMwEPwXVPWpBAwhCZHQqb2jtL1Cr0Aw%2BM3YphBsQNjJEar%2B%2B9H7ilbaWY1Gqx3N7rvWsUk9N10rtf275t8m6SHR9lqt1CD3hiFwh9%2BYYJ1a4fk0shXphSFPpSRjM6im76ThWpXr0F2l22Sz1dfAWusuIFt9RypzS2hZWWtgDGN/bigbpRE2ZOxlX6nVb3bJ8Ikr4/zZ5Y8r1Q8euMZDo5%2BXyWW5Z5nA1c2lwPWVbBfHvmWdR4NspvfusQx4VUKqFj6inFtFnsmF18TmpwK4JsojM7cUZzmqKZzMaCY2Sv0pstCuzDksFg0KPqIF7IFv2JvnaTfaTz9K49vnr38HZHEzFPSCYfw/K4ZOVwV0oL%2BeOiJ4i%2B3iMw/0v8NTEzaeG8LusGT0JhXuCSVTGwO0QX7hhJwXWRe1ie8I5FPIRBy8pE8I3qMZ%2BfULEo/zq5iO5aH4W2TEoTC8wDT7EweRDXmclAF6fD1mdQgGlYK4C03wkKV3%2BJCarvbx8Q8%3D +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 + response: + body: + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VJhb6MwDP0vqNqnUZLQrqUSOpU7WqRbqdbSBvIthNAyEkAktF2n%2fffLdNN%2bw51kW8%2bW9Sz7%2bd1q%2bE0%2fV02trMW7FS73yWFvLayz1p1aOI6kDT1xyRs9pveh52PWSkcNuWJ91emqbZTjodKbFvPSdtnTzJ5ANLE9yGb2nJVgxoq8RBPodH17qQreK2dTsb5VbanHv%2fnbkQ5CO5fPqH6MdNv58IF2lX0xnYbcRwB6NjAGH0aqNhPbmjd%2bsT7ei5X3mq9FmeNCG9yTVKAsPSqDz8wVQwY9QNIYpEgLnpJzgW8gvjOXJOEtRmSepwJnpoal6IlxHoknfvJ969H6GcbJbvn8799hz%2ftLxXhAFS8eE%2bkNZH%2bjG3m9JhjWHK%2fSw2tAcTi5ZkcGc0kiEgX1LuyGDEFFUXjHCfhcGIf%2fkep%2fVY7i8usLvvPcDQSTK0CxNzCUTbe%2f2JUkO1FGwZS6RG6Tk7tZHwB5MSp%2ffPwB"}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '1793' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:56 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: b9c365e5-e09a-4cda-8f62-9912b4a90b9c + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=1VJhb6MwDP0vqNqnUZLQrqUSOpU7WqRbqdbSBvIthNAyEkAktF2n/ffLdNN%2Bw51kW8%2BW9Sz7%2Bd1q%2BE0/V02trMW7FS73yWFvLayz1p1aOI6kDT1xyRs9pveh52PWSkcNuWJ91emqbZTjodKbFvPSdtnTzJ5ANLE9yGb2nJVgxoq8RBPodH17qQreK2dTsb5VbanHv/nbkQ5CO5fPqH6MdNv58IF2lX0xnYbcRwB6NjAGH0aqNhPbmjd%2BsT7ei5X3mq9FmeNCG9yTVKAsPSqDz8wVQwY9QNIYpEgLnpJzgW8gvjOXJOEtRmSepwJnpoal6IlxHoknfvJ969H6GcbJbvn8799hz/tLxXhAFS8eE%2BkNZH%2BjG3m9JhjWHK/Sw2tAcTi5ZkcGc0kiEgX1LuyGDEFFUXjHCfhcGIf/kep/VY7i8usLvvPcDQSTK0CxNzCUTbe/2JUkO1FGwZS6RG6Tk7tZHwB5MSp/fPwB + response: + body: + string: '{"value":[]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-length: '133' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:57 GMT + expires: '-1' + pragma: no-cache + strict-transport-security: max-age=31536000; includeSubDomains + vary: Accept-Encoding + x-content-type-options: nosniff + x-ms-original-request-ids: 1be66f9b-a058-41ce-a574-8406643c4ea9 + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=1VJhb6MwDP0vqNqnUZLQrqUSOpU7WqRbqdbSBvIthNAyEkAktF2n/ffLdNN%2Bw51kW8%2BW9Sz7%2Bd1q%2BE0/V02trMW7FS73yWFvLayz1p1aOI6kDT1xyRs9pveh52PWSkcNuWJ91emqbZTjodKbFvPSdtnTzJ5ANLE9yGb2nJVgxoq8RBPodH17qQreK2dTsb5VbanHv/nbkQ5CO5fPqH6MdNv58IF2lX0xnYbcRwB6NjAGH0aqNhPbmjd%2BsT7ei5X3mq9FmeNCG9yTVKAsPSqDz8wVQwY9QNIYpEgLnpJzgW8gvjOXJOEtRmSepwJnpoal6IlxHoknfvJ969H6GcbJbvn8799hz/tLxXhAFS8eE%2BkNZH%2BjG3m9JhjWHK/Sw2tAcTi5ZkcGc0kiEgX1LuyGDEFFUXjHCfhcGIf/kep/VY7i8usLvvPcDQSTK0CxNzCUTbe/2JUkO1FGwZS6RG6Tk7tZHwB5MSp/fPwB +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/providers/Microsoft.KeyVault/operations?api-version=2019-09-01 + response: + body: + string: '{"value":[{"name":"Microsoft.KeyVault/register/action","display":{"provider":"Microsoft + Key Vault","resource":"Subscription","operation":"Register Subscription","description":"Registers + a subscription"},"isDataAction":false},{"name":"Microsoft.KeyVault/unregister/action","display":{"provider":"Microsoft + Key Vault","resource":"Subscription","operation":"Unregister Subscription","description":"Unregisters + a subscription"},"isDataAction":false},{"name":"Microsoft.KeyVault/operations/read","display":{"provider":"Microsoft + Key Vault","resource":"Operations","operation":"Available Key Vault Operations","description":"Lists + operations available on Microsoft.KeyVault resource provider"},"isDataAction":false},{"name":"Microsoft.KeyVault/locations/operationResults/read","display":{"provider":"Microsoft + Key Vault","resource":"Long Run Operation Result","operation":"Check Operation + Result","description":"Check the result of a long run operation"},"isDataAction":false},{"name":"Microsoft.KeyVault/checkNameAvailability/read","display":{"provider":"Microsoft + Key Vault","resource":"Name Availability","operation":"Check Name Availability","description":"Checks + that a key vault name is valid and is not in use"},"isDataAction":false},{"name":"Microsoft.KeyVault/locations/deleteVirtualNetworkOrSubnets/action","display":{"provider":"Microsoft + Key Vault","resource":"Location","operation":"Delete virtual network or subnets + notification","description":"Notifies Microsoft.KeyVault that a virtual network + or subnet is being deleted"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/read","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault","operation":"View Key Vault","description":"View + the properties of a key vault"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/write","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault","operation":"Update Key Vault","description":"Create + a new key vault or update the properties of an existing key vault"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/delete","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault","operation":"Delete Key Vault","description":"Delete + a key vault"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/deploy/action","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault","operation":"Use Vault for Azure Deployments","description":"Enables + access to secrets in a key vault when deploying Azure resources"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/accessPolicies/write","display":{"provider":"Microsoft + Key Vault","resource":"Access Policy","operation":"Update Access Policy","description":"Update + an existing access policy by merging or replacing, or add a new access policy + to a vault."},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/providers/Microsoft.Insights/logDefinitions/read","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault Log Definition","operation":"Read log definition","description":"Gets + the available logs for a key vault"},"isDataAction":false,"properties":{"serviceSpecification":{"logSpecifications":[{"name":"AuditEvent","displayName":"Audit + Logs","blobDuration":"PT1H"}]}}},{"origin":"system","name":"Microsoft.KeyVault/vaults/providers/Microsoft.Insights/diagnosticSettings/Read","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault Diagnostic Settings","operation":"Read diagnostic + setting","description":"Gets the diagnostic setting for the resource"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/providers/Microsoft.Insights/diagnosticSettings/Write","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault Diagnostic Settings","operation":"Write diagnostic + setting","description":"Creates or updates the diagnostic setting for the + resource"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateLinkResources/read","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault","operation":"Get private link resources","description":"Get + the available private link resources for the specified instance of Key Vault"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/PrivateEndpointConnectionsApproval/action","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection","operation":"Approve or + reject a Private Endpoint connection","description":"Approve or reject a connection + to a Private Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnectionProxies/read","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection Proxy","operation":"View + state of Private Endpoint Connection Proxy","description":"View the state + of a connection proxy to a Private Endpoint resource of Microsoft.Network + provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnectionProxies/write","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection Proxy","operation":"Change + state of Private Endpoint Connection Proxy","description":"Change the state + of a connection proxy to a Private Endpoint resource of Microsoft.Network + provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnectionProxies/delete","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection Proxy","operation":"Delete + a Private Endpoint Connection Proxy","description":"Delete a connection proxy + to a Private Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnectionProxies/validate/action","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection Proxy","operation":"Validate + a Private Endpoint Connection Proxy","description":"Validate a connection + proxy to a Private Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnections/read","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection","operation":"View state + of Private Endpoint connection","description":"View the state of a connection + to a Private Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnections/write","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection","operation":"Change state + of Private Endpoint connection","description":"Change the state of a connection + to a Private Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/privateEndpointConnections/delete","display":{"provider":"Microsoft + Key Vault","resource":"Private Endpoint Connection","operation":"Delete a + Private Endpoint connection","description":"Delete a connection to a Private + Endpoint resource of Microsoft.Network provider"},"isDataAction":false},{"name":"Microsoft.KeyVault/deletedVaults/read","display":{"provider":"Microsoft + Key Vault","resource":"Soft Deleted Key Vault","operation":"View Soft Deleted + Vaults","description":"View the properties of soft deleted key vaults"},"isDataAction":false},{"name":"Microsoft.KeyVault/locations/deletedVaults/read","display":{"provider":"Microsoft + Key Vault","resource":"Soft Deleted Key Vault","operation":"View Soft Deleted + Key Vault","description":"View the properties of a soft deleted key vault"},"isDataAction":false},{"name":"Microsoft.KeyVault/locations/deletedVaults/purge/action","display":{"provider":"Microsoft + Key Vault","resource":"Soft Deleted Key Vault","operation":"Purge Soft Deleted + Key Vault","description":"Purge a soft deleted key vault"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/certificatecas/delete","display":{"provider":"Microsoft + Key Vault","resource":"Certificate Issuser","operation":"Delete Certificate + Issuser","description":"Delete Certificate Issuser"},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificatecas/read","display":{"provider":"Microsoft + Key Vault","resource":"Certificate Issuser","operation":"Read Certificate + Issuser","description":"Read Certificate Issuser"},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificatecas/write","display":{"provider":"Microsoft + Key Vault","resource":"Certificate Issuser","operation":"Write Certificate + Issuser","description":"Write Certificate Issuser"},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificatecontacts/write","display":{"provider":"Microsoft + Key Vault","resource":"Certificate Contact","operation":"Manage Certificate + Contact","description":"Manage Certificate Contact"},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/delete","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Delete Certificate","description":"Delete + a certificate."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/read","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Read Certificate Properties","description":"List + certificates in a specified key vault, or get information about a certificate."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/backup/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Backup Certificate","description":"Create + the backup file of a certificate. The file can used to restore the certificate + in a Key Vault of same subscription. Restrictions may apply."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/purge/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Purge Certificate","description":"Purges + a certificate, making it unrecoverable."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/update/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Update Certificate","description":"Updates + the specified attributes associated with the given certificate."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/create/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Create Certificate","description":"Creates + a new certificate."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/import/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Import Certificate","description":"Imports + an existing valid certificate, containing a private key, into Azure Key Vault. + The certificate to be imported can be in either PFX or PEM format."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/recover/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Recover Certificate","description":"Recovers + the deleted certificate. The operation performs the reversal of the Delete + operation. The operation is applicable in vaults enabled for soft-delete, + and must be issued during the retention interval."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/certificates/restore/action","display":{"provider":"Microsoft + Key Vault","resource":"Certificate","operation":"Restore Certificate","description":"Restores + a backed up certificate, and all its versions, to a vault."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/read","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Read Key Properties and Public Key","description":"List + keys in the specified vault, or read properties and public material of a key. + For asymmetric keys, this operation exposes public key and includes ability + to perform public key algorithms such as encrypt and verify signature. Private + keys and symmetric keys are never exposed."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/update/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Update Key","description":"Updates + the specified attributes associated with the given key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/create/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Create Key","description":"Creates + a new key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/import/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Import Key","description":"Imports + an externally created key, stores it, and returns key parameters and attributes + to the client."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/recover/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Recover Key","description":"Recovers + the deleted key. The operation performs the reversal of the Delete operation. + The operation is applicable in vaults enabled for soft-delete, and must be + issued during the retention interval."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/restore/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Restore Key","description":"Restores + a backed up key, and all its versions, to a vault."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/delete","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Delete Key","description":"Delete + a key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/backup/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Backup Key","description":"Create + the backup file of a key. The file can used to restore the key in a Key Vault + of same subscription. Restrictions may apply."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/purge/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Purge Key","description":"Purges + a key, making it unrecoverable."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/encrypt/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Encrypt with Key","description":"Encrypt + plaintext with a key. Note that if the key is asymmetric, this operation can + be performed by principals with read access."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/decrypt/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Decrypt with Key","description":"Decrypt + ciphertext with a key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/wrap/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Wrap with Key","description":"Wrap + a symmetric key with a Key Vault key. Note that if the Key Vault key is asymmetric, + this operation can be performed with read access."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/unwrap/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Unwrap with Key","description":"Unwrap + a symmetric key with a Key Vault key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/sign/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Sign with Key","description":"Sign + a hash with a key."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/keys/verify/action","display":{"provider":"Microsoft + Key Vault","resource":"Key","operation":"Verify With Key","description":"Verify + a hash. Note that if the key is asymmetric, this operation can be performed + by principals with read access."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/read","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Read Secret Properties","description":"View + the properties of a secret, but not its value."},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/secrets/write","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Write Secret","description":"Create + a new secret or update the value of an existing secret."},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/secrets/delete","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Delete Secret","description":"Delete + a secret."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/backup/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Backup Secret","description":"Create + the backup file of a secret. The file can used to restore the secret in a + Key Vault of same subscription. Restrictions may apply."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/purge/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Purge Secret","description":"Purges + a secret, making it unrecoverable."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/update/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Update Secret","description":"Updates + the specified attributes associated with the given secret."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/recover/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Recover Secret","description":"Recovers + the deleted secret. The operation performs the reversal of the Delete operation. + The operation is applicable in vaults enabled for soft-delete, and must be + issued during the retention interval."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/restore/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Restore Secret","description":"Restores + a backed up secret, and all its versions, to a vault."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/readMetadata/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"List or Read Secret Properties","description":"List + or view the properties of a secret, but not its value."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/getSecret/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Get Secret","description":"Get + the value of a secret."},"isDataAction":true},{"name":"Microsoft.KeyVault/vaults/secrets/setSecret/action","display":{"provider":"Microsoft + Key Vault","resource":"Secret","operation":"Create Secret","description":"Create + new secret."},"isDataAction":true},{"name":"Microsoft.KeyVault/hsmPools/read","display":{"provider":"Microsoft + Key Vault","resource":"HSM pool","operation":"View HSM pool","description":"View + the properties of an HSM pool"},"isDataAction":false},{"name":"Microsoft.KeyVault/hsmPools/write","display":{"provider":"Microsoft + Key Vault","resource":"HSM pool","operation":"Create or Update HSM pool","description":"Create + a new HSM pool of update the properties of an existing HSM pool"},"isDataAction":false},{"name":"Microsoft.KeyVault/hsmPools/delete","display":{"provider":"Microsoft + Key Vault","resource":"HSM pool","operation":"Delete HSM pool","description":"Delete + an HSM pool"},"isDataAction":false},{"name":"Microsoft.KeyVault/hsmPools/joinVault/action","display":{"provider":"Microsoft + Key Vault","resource":"HSM pool","operation":"Join KeyVault to HSM pool","description":"Join + a key vault to an HSM pool"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/eventGridFilters/read","display":{"provider":"Microsoft + Key Vault","resource":"EventGrid Subscription for Key Vault","operation":"View + EventGrid Subscription for Key Vault notification","description":"Notifies + Microsoft.KeyVault that an EventGrid Subscription for Key Vault is being viewed"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/eventGridFilters/write","display":{"provider":"Microsoft + Key Vault","resource":"EventGrid Subscription for Key Vault","operation":"Create + EventGrid Subscription for Key Vault notification","description":"Notifies + Microsoft.KeyVault that a new EventGrid Subscription for Key Vault is being + created"},"isDataAction":false},{"name":"Microsoft.KeyVault/vaults/eventGridFilters/delete","display":{"provider":"Microsoft + Key Vault","resource":"EventGrid Subscription for Key Vault","operation":"Delete + EventGrid Subscription for Key Vault notification","description":"Notifies + Microsoft.KeyVault that an EventGrid Subscription for Key Vault is being deleted"},"isDataAction":false},{"origin":"system","name":"Microsoft.KeyVault/vaults/providers/Microsoft.Insights/metricDefinitions/read","display":{"provider":"Microsoft + Key Vault","resource":"Key Vault Metric Definition","operation":"Read metric + definition","description":"Gets the available metrics for a key vault"},"isDataAction":false,"properties":{"serviceSpecification":{"metricSpecifications":[{"name":"ServiceApiHit","displayName":"Total + Service Api Hits","displayDescription":"Number of total service api hits","unit":"Count","aggregationType":"Count","dimensions":[{"name":"ActivityType","displayName":"Activity + Type","toBeExportedForShoebox":true},{"name":"ActivityName","displayName":"Activity + Name","toBeExportedForShoebox":true}],"fillGapWithZero":true},{"name":"ServiceApiLatency","displayName":"Overall + Service Api Latency","displayDescription":"Overall latency of service api + requests","unit":"Milliseconds","aggregationType":"Average","dimensions":[{"name":"ActivityType","displayName":"Activity + Type","toBeExportedForShoebox":true},{"name":"ActivityName","displayName":"Activity + Name","toBeExportedForShoebox":true},{"name":"StatusCode","displayName":"Status + Code","toBeExportedForShoebox":true},{"name":"StatusCodeClass","displayName":"Status + Code Class","toBeExportedForShoebox":true}],"fillGapWithZero":false},{"name":"ServiceApiResult","displayName":"Total + Service Api Results","displayDescription":"Number of total service api results","unit":"Count","aggregationType":"Count","dimensions":[{"name":"ActivityType","displayName":"Activity + Type","toBeExportedForShoebox":true},{"name":"ActivityName","displayName":"Activity + Name","toBeExportedForShoebox":true},{"name":"StatusCode","displayName":"Status + Code","toBeExportedForShoebox":true},{"name":"StatusCodeClass","displayName":"Status + Code Class","toBeExportedForShoebox":true}],"fillGapWithZero":true},{"name":"SaturationShoebox","displayName":"Overall + Vault Saturation","displayDescription":"Vault capacity used","unit":"Percent","aggregationType":"Average","supportedAggregationTypes":["Average"],"lockAggregationType":"Average","dimensions":[{"name":"ActivityType","displayName":"Activity + Type","toBeExportedForShoebox":true},{"name":"ActivityName","displayName":"Activity + Name","toBeExportedForShoebox":true},{"name":"TransactionType","displayName":"Transaction + Type","toBeExportedForShoebox":true}],"fillGapWithZero":false},{"name":"Availability","displayName":"Overall + Vault Availability","displayDescription":"Vault requests availability","unit":"Percent","aggregationType":"Average","dimensions":[{"name":"ActivityType","displayName":"Activity + Type","toBeExportedForShoebox":true},{"name":"ActivityName","displayName":"Activity + Name","toBeExportedForShoebox":true},{"name":"StatusCode","displayName":"Status + Code","toBeExportedForShoebox":true},{"name":"StatusCodeClass","displayName":"Status + Code Class","toBeExportedForShoebox":true}],"fillGapWithZero":false}]}}}]}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:57 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/providers/Microsoft.KeyVault/operations?api-version=2019-09-01 +- request: + body: '{}' + headers: + Accept: + - application/json + Content-Length: + - '2' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: PATCH + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:58 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-ms-ratelimit-remaining-subscription-writes: '1197' + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: '{"name": "sample-vault", "type": "Microsoft.KeyVault/vaults"}' + headers: + Accept: + - application/json + Content-Length: + - '61' + Content-Type: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2019-09-01 + response: + body: + string: '{"nameAvailable":false,"reason":"AlreadyExists","message":"The name + ''sample-vault'' is already in use."}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:21:58 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2019-09-01 +- request: + body: null + headers: + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: DELETE + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 02 Jun 2020 05:22:01 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-ms-ratelimit-remaining-subscription-deletes: '14999' + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz?api-version=2019-09-01 + response: + body: + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","location":"eastus","tags":{},"deletionDate":"2020-06-02T05:21:59Z","scheduledPurgeDate":"2020-08-31T05:21:59Z"}}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:22:02 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz?api-version=2019-09-01 +- request: + body: null + headers: + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: POST + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz/purge?api-version=2019-09-01 + response: + body: + string: '' + headers: + cache-control: no-cache + content-length: '0' + date: Tue, 02 Jun 2020 05:22:02 GMT + expires: '-1' + location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-ms-ratelimit-remaining-subscription-writes: '1198' + x-powered-by: ASP.NET + status: + code: 202 + message: Accepted + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz/purge?api-version=2019-09-01 +- request: + body: null + headers: + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-06-02 05:22:02Z","status":"NotStarted"}' + headers: + cache-control: no-cache + content-length: '64' + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:22:07 GMT + expires: '-1' + location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 202 + message: Accepted + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 +- request: + body: null + headers: + User-Agent: + - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) + method: GET + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 + response: + body: + string: '{"createdDateTime":"2020-06-02 05:22:02Z","lastActionDateTime":"2020-06-02 + 05:22:09Z","status":"Succeeded"}' + headers: + cache-control: no-cache + content-encoding: gzip + content-type: application/json; charset=utf-8 + date: Tue, 02 Jun 2020 05:22:12 GMT + expires: '-1' + pragma: no-cache + server: Microsoft-IIS/10.0 + strict-transport-security: max-age=31536000; includeSubDomains + transfer-encoding: chunked + vary: Accept-Encoding + x-aspnet-version: 4.0.30319 + x-content-type-options: nosniff + x-ms-keyvault-service-version: 1.1.0.281 + x-powered-by: ASP.NET + status: + code: 200 + message: OK + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzI2NjcyMTIzNDgxMTM5Mnw3N0FDREY4RUI0QUI0N0E2QTBBQ0RBOUI2NTNCMjYzRA?api-version=2019-09-01 +version: 1 diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py new file mode 100644 index 000000000000..06ccebfb1670 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py @@ -0,0 +1,321 @@ +# 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. +#-------------------------------------------------------------------------- + + +# TEST SCENARIO COVERAGE +# ---------------------- +# Methods Total : 17 +# Methods Covered : 17 +# Examples Total : 18 +# Examples Tested : 18 +# Coverage % : 100 +# ---------------------- + +import unittest + +import azure.mgmt.keyvault.aio +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer + +from _aio_testcase import AzureMgmtAsyncTestCase + +AZURE_LOCATION = 'eastus' + +class MgmtKeyVaultTest(AzureMgmtAsyncTestCase): + + def setUp(self): + super(MgmtKeyVaultTest, self).setUp() + self.mgmt_client = self.create_mgmt_aio_client( + azure.mgmt.keyvault.aio.KeyVaultManagementClient + ) + + @ResourceGroupPreparer(location=AZURE_LOCATION) + def test_keyvault(self, resource_group): + + SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID + TENANT_ID = "72f988bf-86f1-41af-91ab-2d7cd011db47" # self.settings.TENANT_ID + RESOURCE_GROUP = resource_group.name + VAULT_NAME = "myValtZikfikxyzz" + OPERATION_KIND = "add" + LOCATION = "eastus" + PRIVATE_ENDPOINT_CONNECTION_NAME = "myPrivateEndpointConnection" + + # /Vaults/put/Create a new vault or update an existing vault[put] + BODY = { + "location": LOCATION, + "properties": { + "tenant_id": TENANT_ID, + "sku": { + "family": "A", + "name": "standard" + }, + "access_policies": [ + { + "tenant_id": TENANT_ID, + "object_id": "00000000-0000-0000-0000-000000000000", + "permissions": { + "keys": [ + "encrypt", + "decrypt", + "wrapKey", + "unwrapKey", + "sign", + "verify", + "get", + "list", + "create", + "update", + "import", + "delete", + "backup", + "restore", + "recover", + "purge" + ], + "secrets": [ + "get", + "list", + "set", + "delete", + "backup", + "restore", + "recover", + "purge" + ], + "certificates": [ + "get", + "list", + "delete", + "create", + "import", + "update", + "managecontacts", + "getissuers", + "listissuers", + "setissuers", + "deleteissuers", + "manageissuers", + "recover", + "purge" + ] + } + } + ], + "enabled_for_deployment": True, + "enabled_for_disk_encryption": True, + "enabled_for_template_deployment": True + } + } + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.begin_create_or_update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=BODY) + ) + result = self.event_loop.run_until_complete( + result.result() + ) + + # /Vaults/put/Create or update a vault with network acls[put] + BODY = { + "location": LOCATION, + "properties": { + "tenant_id": "00000000-0000-0000-0000-000000000000", + "sku": { + "family": "A", + "name": "standard" + }, + "network_acls": { + "default_action": "Deny", + "bypass": "AzureServices", + "ip_rules": [ + { + "value": "124.56.78.91" + }, + { + "value": "'10.91.4.0/24'" + } + ], + "virtual_network_rules": [ + { + "id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Network/virtualNetworkstest-vnet/subnetssubnet1" + } + ] + }, + "enabled_for_deployment": True, + "enabled_for_disk_encryption": True, + "enabled_for_template_deployment": True + } + } + #result = self.mgmt_client.vaults.create_or_update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=BODY) + #result = result.result() + + # /Vaults/put/Add an access policy, or update an access policy with new permissions[put] + PARAMETERS = { + "properties": { + "access_policies": [ + { + "tenant_id": TENANT_ID, + "object_id": "00000000-0000-0000-0000-000000000000", + "permissions": { + "keys": [ + "encrypt" + ], + "secrets": [ + "get" + ], + "certificates": [ + "get" + ] + } + } + ] + } + } + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.update_access_policy(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, operation_kind=OPERATION_KIND, parameters=PARAMETERS) + ) + + # /PrivateEndpointConnections/put/KeyVaultPutPrivateEndpointConnection[put] + BODY = { + "private_link_service_connection_state": { + "status": "Approved", + "description": "My name is Joe and I'm approving this." + } + } + # result = self.mgmt_client.private_endpoint_connections.put(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME, properties=BODY) + + # /PrivateEndpointConnections/get/KeyVaultGetPrivateEndpointConnection[get] + # result = self.mgmt_client.private_endpoint_connections.get(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) + + # /PrivateLinkResources/get/KeyVaultListPrivateLinkResources[get] + # result = self.mgmt_client.private_link_resources.list_by_vault(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME) + + # /Vaults/get/Retrieve a vault[get] + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.get(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME) + ) + + # /Vaults/get/List vaults in the specified resource group[get] + result = self.to_list( + self.mgmt_client.vaults.list_by_resource_group(resource_group_name=RESOURCE_GROUP, top="1") + ) + + # /Vaults/get/List deleted vaults in the specified subscription[get] + result = self.to_list( + self.mgmt_client.vaults.list_deleted() + ) + + # /Vaults/get/List vaults in the specified subscription[get] + result = self.to_list( + self.mgmt_client.vaults.list_by_subscription(top="1") + ) + + # /Vaults/get/List vaults in the specified subscription[get] + result = self.to_list( + self.mgmt_client.vaults.list_by_subscription(top="1") + ) + + # /Operations/get/Lists available Rest API operations.[get] + result = self.to_list( + self.mgmt_client.operations.list() + ) + + # /Vaults/patch/Update an existing vault[patch] + PROPERTIES = { + "tenant_id": TENANT_ID, + "sku": { + "family": "A", + "name": "standard" + }, + "access_policies": [ + { + "tenant_id": TENANT_ID, + "object_id": "00000000-0000-0000-0000-000000000000", + "permissions": { + "keys": [ + "encrypt", + "decrypt", + "wrapKey", + "unwrapKey", + "sign", + "verify", + "get", + "list", + "create", + "update", + "import", + "delete", + "backup", + "restore", + "recover", + "purge" + ], + "secrets": [ + "get", + "list", + "set", + "delete", + "backup", + "restore", + "recover", + "purge" + ], + "certificates": [ + "get", + "list", + "delete", + "create", + "import", + "update", + "managecontacts", + "getissuers", + "listissuers", + "setissuers", + "deleteissuers", + "manageissuers", + "recover", + "purge" + ] + } + } + ], + "enabled_for_deployment": True, + "enabled_for_disk_encryption": True, + "enabled_for_template_deployment": True + } + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.update(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, parameters=PROPERTIES) + ) + + # /Vaults/post/Validate a vault name[post] + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.check_name_availability({ 'name': 'sample-vault', 'type': 'Microsoft.KeyVault/vaults' }) + ) + + # /PrivateEndpointConnections/delete/KeyVaultDeletePrivateEndpointConnection[delete] + # result = self.mgmt_client.private_endpoint_connections.delete(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME, private_endpoint_connection_name=PRIVATE_ENDPOINT_CONNECTION_NAME) + # result = result.result() + + # /Vaults/delete/Delete a vault[delete] + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.delete(resource_group_name=RESOURCE_GROUP, vault_name=VAULT_NAME) + ) + + # /Vaults/get/Retrieve a deleted vault[get] + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.get_deleted(location=LOCATION, vault_name=VAULT_NAME) + ) + + # /Vaults/post/Purge a deleted vault[post] + result = self.event_loop.run_until_complete( + self.mgmt_client.vaults.begin_purge_deleted(location=LOCATION, vault_name=VAULT_NAME) + ) + result = self.event_loop.run_until_complete( + result.result() + ) + +#------------------------------------------------------------------------------ +if __name__ == '__main__': + unittest.main() From 3bbe7dd051e66e4ef0c7e1fb4165b2787ba6c7a9 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Sun, 7 Jun 2020 05:30:33 +0200 Subject: [PATCH 5/9] aiohttp --- sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt diff --git a/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt b/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt new file mode 100644 index 000000000000..8625fcf6ef8d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/dev_requirements.txt @@ -0,0 +1 @@ +aiohttp>=3.0; python_version >= '3.5' From a3172e11c9c4fd92e18f33f562f04948bde9e73f Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Sun, 7 Jun 2020 05:40:36 +0200 Subject: [PATCH 6/9] fixing async test --- .../tests/_aio_testcase.py | 2 +- .../azure-mgmt-keyvault/tests/conftest.py | 32 +++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/tests/conftest.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py b/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py index 2ed8b31b3121..828424229f97 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/_aio_testcase.py @@ -2,7 +2,6 @@ from unittest.mock import Mock from azure.core.credentials import AccessToken -from azure.identity.aio import DefaultAzureCredential from devtools_testutils import AzureMgmtTestCase class AzureMgmtAsyncTestCase(AzureMgmtTestCase): @@ -16,6 +15,7 @@ def event_loop(self): def create_mgmt_aio_client(self, client, **kwargs): if self.is_live: + from azure.identity.aio import DefaultAzureCredential credential = DefaultAzureCredential() else: credential = Mock(get_token=asyncio.coroutine(lambda _: AccessToken("fake-token", 0))) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/conftest.py b/sdk/keyvault/azure-mgmt-keyvault/tests/conftest.py new file mode 100644 index 000000000000..ff2e5bbbae41 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/conftest.py @@ -0,0 +1,32 @@ +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- +import platform +import sys + +# Ignore async tests for Python < 3.5 +collect_ignore_glob = [] +if sys.version_info < (3, 5) or platform.python_implementation() == "PyPy": + collect_ignore_glob.append("*_async.py") From 684a35a1b758cf2cabe773be4249c26391a8747f Mon Sep 17 00:00:00 2001 From: Kerwin Sun Date: Thu, 11 Jun 2020 11:31:04 +0800 Subject: [PATCH 7/9] add random group name (#11909) --- .../test_cli_mgmt_keyvault.test_keyvault.yaml | 24 ++++----- ...cli_mgmt_keyvault_async.test_keyvault.yaml | 50 +++++++++---------- .../tests/test_cli_mgmt_keyvault.py | 4 +- .../tests/test_cli_mgmt_keyvault_async.py | 4 +- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml index bb53466e8078..9030b82ee416 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.test_keyvault.yaml @@ -24,10 +24,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxy.vault.azure.net","provisioningState":"RegisteringDns"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxy.vault.azure.net","provisioningState":"RegisteringDns"}}' headers: cache-control: - no-cache @@ -74,10 +74,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -128,10 +128,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/add?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/add?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' headers: cache-control: - no-cache @@ -178,10 +178,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -230,10 +230,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","accessPolicies":[{"tenantId":"72f988bf-86f1-41af-91ab-2d7cd011db47","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxy.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: - no-cache @@ -335,7 +335,7 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy?api-version=2019-09-01 response: body: string: '' @@ -382,7 +382,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_test_keyvault14930f02/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","location":"eastus","tags":{},"deletionDate":"2020-04-29T10:45:24Z","scheduledPurgeDate":"2020-07-28T10:45:24Z"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxy","name":"myValtZikfikxy","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxy","location":"eastus","tags":{},"deletionDate":"2020-04-29T10:45:24Z","scheduledPurgeDate":"2020-07-28T10:45:24Z"}}' headers: cache-control: - no-cache diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml index f2bd49578007..cfc159997b0e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault_async.test_keyvault.yaml @@ -20,10 +20,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxyzz.vault.azure.net","provisioningState":"RegisteringDns"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myValtZikfikxyzz.vault.azure.net","provisioningState":"RegisteringDns"}}' headers: cache-control: no-cache content-encoding: gzip @@ -43,17 +43,17 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 - request: body: null headers: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: no-cache content-encoding: gzip @@ -72,7 +72,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 - request: body: 'b''{"properties": {"accessPolicies": [{"tenantId": "00000000-0000-0000-0000-000000000000", "objectId": "00000000-0000-0000-0000-000000000000", "permissions": {"keys": @@ -87,10 +87,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PUT - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/","type":"Microsoft.KeyVault/vaults/accessPolicies","properties":{"accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}]}}' headers: cache-control: no-cache content-encoding: gzip @@ -110,7 +110,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz/accessPolicies/add?api-version=2019-09-01 - request: body: null headers: @@ -119,10 +119,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: no-cache content-encoding: gzip @@ -141,7 +141,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 - request: body: null headers: @@ -150,10 +150,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg=="}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg=="}' headers: cache-control: no-cache content-encoding: gzip @@ -172,7 +172,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 - request: body: null headers: @@ -181,7 +181,7 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: GET - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== response: body: string: '{"value":[]}' @@ -203,7 +203,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01&$skiptoken=bXlWYWx0WmlrZmlreHl6eg== - request: body: null headers: @@ -271,7 +271,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VHRbqMwEPwXVPWpBAwhCZHQqb2jtL1Cr0Aw%2bM3YphBsQNjJEar%2b%2b9H7ilbaWY1Gqx3N7rvWsUk9N10rtf275t8m6SHR9lqt1CD3hiFwh9%2bYYJ1a4fk0shXphSFPpSRjM6im76ThWpXr0F2l22Sz1dfAWusuIFt9RypzS2hZWWtgDGN%2fbigbpRE2ZOxlX6nVb3bJ8Ikr4%2fzZ5Y8r1Q8euMZDo5%2bXyWW5Z5nA1c2lwPWVbBfHvmWdR4NspvfusQx4VUKqFj6inFtFnsmF18TmpwK4JsojM7cUZzmqKZzMaCY2Sv0pstCuzDksFg0KPqIF7IFv2JvnaTfaTz9K49vnr38HZHEzFPSCYfw%2fK4ZOVwV0oL%2beOiJ4i%2b3iMw%2f0v8NTEzaeG8LusGT0JhXuCSVTGwO0QX7hhJwXWRe1ie8I5FPIRBy8pE8I3qMZ%2bfULEo%2fzq5iO5aH4W2TEoTC8wDT7EweRDXmclAF6fD1mdQgGlYK4C03wkKV3%2bJCarvbx8Q8%3d"}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VHRbqMwEPwXVPWpBAwhCZHQqb2jtL1Cr0Aw%2bM3YphBsQNjJEar%2b%2b9H7ilbaWY1Gqx3N7rvWsUk9N10rtf275t8m6SHR9lqt1CD3hiFwh9%2bYYJ1a4fk0shXphSFPpSRjM6im76ThWpXr0F2l22Sz1dfAWusuIFt9RypzS2hZWWtgDGN%2fbigbpRE2ZOxlX6nVb3bJ8Ikr4%2fzZ5Y8r1Q8euMZDo5%2bXyWW5Z5nA1c2lwPWVbBfHvmWdR4NspvfusQx4VUKqFj6inFtFnsmF18TmpwK4JsojM7cUZzmqKZzMaCY2Sv0pstCuzDksFg0KPqIF7IFv2JvnaTfaTz9K49vnr38HZHEzFPSCYfw%2fK4ZOVwV0oL%2beOiJ4i%2b3iMw%2f0v8NTEzaeG8LusGT0JhXuCSVTGwO0QX7hhJwXWRe1ie8I5FPIRBy8pE8I3qMZ%2bfULEo%2fzq5iO5aH4W2TEoTC8wDT7EweRDXmclAF6fD1mdQgGlYK4C03wkKV3%2bJCarvbx8Q8%3d"}' headers: cache-control: no-cache content-encoding: gzip @@ -327,7 +327,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?$top=1&api-version=2019-09-01 response: body: - string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VJhb6MwDP0vqNqnUZLQrqUSOpU7WqRbqdbSBvIthNAyEkAktF2n%2fffLdNN%2bw51kW8%2bW9Sz7%2bd1q%2bE0%2fV02trMW7FS73yWFvLayz1p1aOI6kDT1xyRs9pveh52PWSkcNuWJ91emqbZTjodKbFvPSdtnTzJ5ANLE9yGb2nJVgxoq8RBPodH17qQreK2dTsb5VbanHv%2fnbkQ5CO5fPqH6MdNv58IF2lX0xnYbcRwB6NjAGH0aqNhPbmjd%2bsT7ei5X3mq9FmeNCG9yTVKAsPSqDz8wVQwY9QNIYpEgLnpJzgW8gvjOXJOEtRmSepwJnpoal6IlxHoknfvJ969H6GcbJbvn8799hz%2ftLxXhAFS8eE%2bkNZH%2bjG3m9JhjWHK%2fSw2tAcTi5ZkcGc0kiEgX1LuyGDEFFUXjHCfhcGIf%2fkep%2fVY7i8usLvvPcDQSTK0CxNzCUTbe%2f2JUkO1FGwZS6RG6Tk7tZHwB5MSp%2ffPwB"}' + string: '{"value":[{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-changlong/providers/Microsoft.KeyVault/vaults/test-changlong","name":"test-changlong","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"6bedd520-9535-468f-9ab3-79d17bea1b92","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"enableSoftDelete":true,"softDeleteRetentionInDays":90,"enableRbacAuthorization":false,"vaultUri":"https://test-changlong.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/git2gridtesting/providers/Microsoft.KeyVault/vaults/git2gridkv","name":"git2gridkv","type":"Microsoft.KeyVault/vaults","location":"centralus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"7b5d64cb-f02f-4b19-ab5d-60dca4916c54","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://git2gridkv.vault.azure.net/","provisioningState":"Succeeded"}},{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/azure-sdk-for-node/providers/Microsoft.KeyVault/vaults/node-sdk-kv","name":"node-sdk-kv","type":"Microsoft.KeyVault/vaults","location":"westus","tags":{},"properties":{"sku":{"family":"A","name":"Standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"52bcebf6-9dc1-4a9a-8b3b-6962bb22a6aa","permissions":{"keys":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore"],"secrets":["Get","List","Set","Delete","Recover","Backup","Restore"],"certificates":["Get","List","Update","Create","Import","Delete","Recover","Backup","Restore","ManageContacts","ManageIssuers","GetIssuers","ListIssuers","SetIssuers","DeleteIssuers"]}}],"enabledForDeployment":false,"enabledForDiskEncryption":false,"enabledForTemplateDeployment":false,"vaultUri":"https://node-sdk-kv.vault.azure.net/","provisioningState":"Succeeded"}}],"nextLink":"https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/vaults?%24top=1&api-version=2019-09-01&%24skiptoken=1VJhb6MwDP0vqNqnUZLQrqUSOpU7WqRbqdbSBvIthNAyEkAktF2n%2fffLdNN%2bw51kW8%2bW9Sz7%2bd1q%2bE0%2fV02trMW7FS73yWFvLayz1p1aOI6kDT1xyRs9pveh52PWSkcNuWJ91emqbZTjodKbFvPSdtnTzJ5ANLE9yGb2nJVgxoq8RBPodH17qQreK2dTsb5VbanHv%2fnbkQ5CO5fPqH6MdNv58IF2lX0xnYbcRwB6NjAGH0aqNhPbmjd%2bsT7ei5X3mq9FmeNCG9yTVKAsPSqDz8wVQwY9QNIYpEgLnpJzgW8gvjOXJOEtRmSepwJnpoal6IlxHoknfvJ969H6GcbJbvn8799hz%2ftLxXhAFS8eE%2bkNZH%2bjG3m9JhjWHK%2fSw2tAcTi5ZkcGc0kiEgX1LuyGDEFFUXjHCfhcGIf%2fkep%2fVY7i8usLvvPcDQSTK0CxNzCUTbe%2f2JUkO1FGwZS6RG6Tk7tZHwB5MSp%2ffPwB"}' headers: cache-control: no-cache content-encoding: gzip @@ -619,10 +619,10 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: PATCH - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/vaults","location":"eastus","tags":{},"properties":{"sku":{"family":"A","name":"standard"},"tenantId":"00000000-0000-0000-0000-000000000000","accessPolicies":[{"tenantId":"00000000-0000-0000-0000-000000000000","objectId":"00000000-0000-0000-0000-000000000000","permissions":{"keys":["encrypt","decrypt","wrapKey","unwrapKey","sign","verify","get","list","create","update","import","delete","backup","restore","recover","purge"],"secrets":["get","list","set","delete","backup","restore","recover","purge"],"certificates":["get","list","delete","create","import","update","managecontacts","getissuers","listissuers","setissuers","deleteissuers","manageissuers","recover","purge"]}}],"enabledForDeployment":true,"enabledForDiskEncryption":true,"enabledForTemplateDeployment":true,"enableSoftDelete":true,"vaultUri":"https://myvaltzikfikxyzz.vault.azure.net/","provisioningState":"Succeeded"}}' headers: cache-control: no-cache content-encoding: gzip @@ -642,7 +642,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 - request: body: '{"name": "sample-vault", "type": "Microsoft.KeyVault/vaults"}' headers: @@ -685,7 +685,7 @@ interactions: User-Agent: - azsdk-python-azure-mgmt-keyvault/3.0.0b1 Python/3.6.9 (Linux-4.9.184-linuxkit-x86_64-with-Ubuntu-18.04-bionic) method: DELETE - uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: string: '' @@ -705,7 +705,7 @@ interactions: status: code: 200 message: OK - url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 + url: https://management.azure.com/subscriptions/92f95d8f-3c67-4124-91c7-8cf07cdbf241/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz?api-version=2019-09-01 - request: body: null headers: @@ -717,7 +717,7 @@ interactions: uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz?api-version=2019-09-01 response: body: - string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test_cli_mgmt_keyvault_async_test_keyvault777e117f/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","location":"eastus","tags":{},"deletionDate":"2020-06-02T05:21:59Z","scheduledPurgeDate":"2020-08-31T05:21:59Z"}}' + string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxyzz","name":"myValtZikfikxyzz","type":"Microsoft.KeyVault/deletedVaults","properties":{"vaultId":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxyzz","location":"eastus","tags":{},"deletionDate":"2020-06-02T05:21:59Z","scheduledPurgeDate":"2020-08-31T05:21:59Z"}}' headers: cache-control: no-cache content-encoding: gzip diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py index b2e334b5502a..2436ecf38066 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault.py @@ -19,7 +19,7 @@ import unittest import azure.mgmt.keyvault -from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer AZURE_LOCATION = 'eastus' @@ -31,7 +31,7 @@ def setUp(self): azure.mgmt.keyvault.KeyVaultManagementClient ) - @ResourceGroupPreparer(location=AZURE_LOCATION) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_keyvault(self, resource_group): SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py index 06ccebfb1670..81d74737124d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/test_cli_mgmt_keyvault_async.py @@ -19,7 +19,7 @@ import unittest import azure.mgmt.keyvault.aio -from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +from devtools_testutils import AzureMgmtTestCase, RandomNameResourceGroupPreparer from _aio_testcase import AzureMgmtAsyncTestCase @@ -33,7 +33,7 @@ def setUp(self): azure.mgmt.keyvault.aio.KeyVaultManagementClient ) - @ResourceGroupPreparer(location=AZURE_LOCATION) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) def test_keyvault(self, resource_group): SUBSCRIPTION_ID = self.settings.SUBSCRIPTION_ID From 2ff09c6685568edd0a9b614ccd62e5feb6f44c81 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 12 Jun 2020 07:48:49 +0200 Subject: [PATCH 8/9] changelog and version --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 25 +++++++++++++++++++ .../azure/mgmt/keyvault/_version.py | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 3b7bf1cb42fe..109b097d56f6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,5 +1,30 @@ # Release History +## 7.0.0b1 (2020-06-17) + +This is beta preview version. +For detailed changelog please refer to equivalent stable version 2.2.0 (https://pypi.org/project/azure-mgmt-keyvault/2.2.0/) + +This version uses a next-generation code generator that introduces important breaking changes, but also important new features (like unified authentication and async programming). + +**General breaking changes** + +- Credential system has been completly revamped: + + - `azure.common.credentials` or `msrestazure.azure_active_directory` instances are no longer supported, use the `azure-identity` classes instead: https://pypi.org/project/azure-identity/ + - `credentials` parameter has been renamed `credential` + +- The `config` attribute no longer exists on a client, configuration should be passed as kwarg. Example: `MyClient(credential, subscription_id, enable_logging=True)`. For a complete set of + supported options, see the [parameters accept in init documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +- You can't import a `version` module anymore, use `__version__` instead +- Operations that used to return a `msrest.polling.LROPoller` now returns a `azure.core.polling.LROPoller` and are prefixed with `begin_`. +- Exceptions tree have been simplified and most exceptions are now `azure.core.exceptions.HttpResponseError` (`CloudError` has been removed). +- Most of the operation kwarg have changed. Some of the most noticeable: + + - `raw` has been removed. Equivalent feature can be found using `cls`, a callback that will give access to internal HTTP response for advanced user + - For a complete set of + supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) + ## 2.2.0 (2020-03-20) **Features** diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py index bb9696095add..5c6ad95258f3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "3.0.0b1" \ No newline at end of file +VERSION = "7.0.0b1" \ No newline at end of file From 8040d08a0653b5cf6bfab0c090a5d12261863a46 Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Fri, 12 Jun 2020 08:23:38 +0200 Subject: [PATCH 9/9] fixed changelog --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 109b097d56f6..27220b5f5404 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -25,6 +25,12 @@ This version uses a next-generation code generator that introduces important bre - For a complete set of supported options, see the [parameters accept in Request documentation of azure-core](https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/CLIENT_LIBRARY_DEVELOPER.md#available-policies) +**General new features** + +- Type annotations support using `typing`. SDKs are mypy ready. +- This client has now stable and official support for async. Check the `aio` namespace of your package to find the async client. +- This client now support natively tracing library like OpenCensus or OpenTelemetry. See this [tracing quickstart](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/core/azure-core-tracing-opentelemetry) for an overview. + ## 2.2.0 (2020-03-20) **Features**