From ac094927fef45330a022f23d742a0baae0cbec4a Mon Sep 17 00:00:00 2001 From: iscai-msft Date: Fri, 12 Jun 2020 17:00:44 -0400 Subject: [PATCH] generate with autorest v3 --- .../certificates/_generated/__init__.py | 20 +- .../certificates/_generated/_configuration.py | 48 + .../_generated/_key_vault_client.py | 100 + .../_generated/_operations_mixin.py | 3148 +++++++++ .../certificates/_generated/_version.py | 8 + .../version.py => aio/__init__.py} | 11 +- .../_generated/aio/_configuration_async.py | 47 + .../_generated/aio/_key_vault_client_async.py | 100 + .../_generated/aio/_operations_mixin_async.py | 3144 +++++++++ .../certificates/_generated/models.py | 7 + .../keyvault/certificates/_generated/py.typed | 1 + .../_generated/v2016_10_01/__init__.py | 16 +- .../_generated/v2016_10_01/_configuration.py | 46 +- .../v2016_10_01/_key_vault_client.py | 36 +- .../_generated/v2016_10_01/_metadata.json | 837 +++ .../_generated/v2016_10_01/aio/__init__.py | 7 +- .../v2016_10_01/aio/_configuration_async.py | 42 +- .../aio/_key_vault_client_async.py | 32 +- .../aio/operations_async/__init__.py | 7 +- .../_key_vault_client_operations_async.py | 4938 +++++++------- .../_generated/v2016_10_01/models/__init__.py | 190 +- .../models/_key_vault_client_enums.py | 96 +- .../_generated/v2016_10_01/models/_models.py | 1358 ++-- .../v2016_10_01/models/_models_py3.py | 1585 +++-- .../v2016_10_01/operations/__init__.py | 7 +- .../_key_vault_client_operations.py | 4969 +++++++------- .../_generated/v2016_10_01/py.typed | 1 + .../certificates/_generated/v7_0/__init__.py | 16 +- .../_generated/v7_0/_configuration.py | 46 +- .../_generated/v7_0/_key_vault_client.py | 36 +- .../_generated/v7_0/_metadata.json | 969 +++ .../_generated/v7_0/aio/__init__.py | 7 +- .../v7_0/aio/_configuration_async.py | 42 +- .../v7_0/aio/_key_vault_client_async.py | 32 +- .../v7_0/aio/operations_async/__init__.py | 7 +- .../_key_vault_client_operations_async.py | 5662 ++++++++-------- .../_generated/v7_0/models/__init__.py | 210 +- .../v7_0/models/_key_vault_client_enums.py | 118 +- .../_generated/v7_0/models/_models.py | 1589 ++--- .../_generated/v7_0/models/_models_py3.py | 1826 +++--- .../_generated/v7_0/operations/__init__.py | 7 +- .../_key_vault_client_operations.py | 5696 +++++++++-------- .../certificates/_generated/v7_0/py.typed | 1 + .../_generated/v7_1_preview/__init__.py | 16 +- .../_generated/v7_1_preview/_configuration.py | 46 +- .../v7_1_preview/_key_vault_client.py | 34 +- .../_generated/v7_1_preview/_metadata.json | 357 ++ .../_generated/v7_1_preview/aio/__init__.py | 7 +- .../v7_1_preview/aio/_configuration_async.py | 42 +- .../aio/_key_vault_client_async.py | 32 +- .../aio/operations_async/__init__.py | 7 +- .../_key_vault_client_operations_async.py | 5337 +++------------ .../v7_1_preview/models/__init__.py | 256 +- .../models/_key_vault_client_enums.py | 81 +- .../_generated/v7_1_preview/models/_models.py | 2811 ++------ .../v7_1_preview/models/_models_py3.py | 2941 ++------- .../v7_1_preview/operations/__init__.py | 7 +- .../_key_vault_client_operations.py | 5356 +++------------- .../_generated/v7_1_preview/py.typed | 1 + .../_generated/v7_2_preview/__init__.py | 16 + .../_generated/v7_2_preview/_configuration.py | 51 + .../v7_2_preview/_key_vault_client.py | 54 + .../_generated/v7_2_preview/_metadata.json | 357 ++ .../aio/__init__.py} | 11 +- .../v7_2_preview/aio/_configuration_async.py | 45 + .../aio/_key_vault_client_async.py | 46 + .../aio/operations_async/__init__.py | 13 + .../_key_vault_client_operations_async.py | 1855 ++++++ .../v7_2_preview/models/__init__.py | 143 + .../models/_key_vault_client_enums.py | 62 + .../_generated/v7_2_preview/models/_models.py | 1329 ++++ .../v7_2_preview/models/_models_py3.py | 1469 +++++ .../operations/__init__.py} | 12 +- .../_key_vault_client_operations.py | 1886 ++++++ .../_generated/v7_2_preview/py.typed | 1 + 75 files changed, 34714 insertions(+), 27032 deletions(-) create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_key_vault_client.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_operations_mixin.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_version.py rename sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/{v2016_10_01/version.py => aio/__init__.py} (75%) create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/models.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/py.typed create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_metadata.json create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/py.typed create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_metadata.json create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/py.typed create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_metadata.json create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/py.typed create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/__init__.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_configuration.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_key_vault_client.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_metadata.json rename sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/{v7_0/version.py => v7_2_preview/aio/__init__.py} (75%) create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_configuration_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_key_vault_client_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/__init__.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/_key_vault_client_operations_async.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/__init__.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_key_vault_client_enums.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models_py3.py rename sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/{v7_1_preview/version.py => v7_2_preview/operations/__init__.py} (70%) create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/_key_vault_client_operations.py create mode 100644 sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/py.typed diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/__init__.py index b74cfa3b899..a6c1f9b7a79 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/__init__.py @@ -1,4 +1,16 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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_client import KeyVaultClient +__all__ = ['KeyVaultClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py new file mode 100644 index 00000000000..5f1172b862c --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_configuration.py @@ -0,0 +1,48 @@ +# 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 KeyVaultClientConfiguration(Configuration): + """Configuration for KeyVaultClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None + super(KeyVaultClientConfiguration, self).__init__(**kwargs) + + kwargs.setdefault('sdk_moniker', 'azure-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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_key_vault_client.py new file mode 100644 index 00000000000..e4d2a16e6d4 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_key_vault_client.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 azure.core import PipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration import KeyVaultClientConfiguration +from ._operations_mixin import KeyVaultClientOperationsMixin +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 KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + + 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 str api_version: API version to use if no profile is provided, or if + missing in profile. + :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 = '7.0' + _PROFILE_TAG = "azure.keyvault.KeyVaultClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ): + base_url = '{vaultBaseUrl}' + self._config = KeyVaultClientConfiguration(**kwargs) + self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) + super(KeyVaultClient, self).__init__( + 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` + * 7.0: :mod:`v7_0.models` + * 7.1-preview: :mod:`v7_1_preview.models` + * 7.2-preview: :mod:`v7_2_preview.models` + """ + if api_version == '2016-10-01': + from .v2016_10_01 import models + return models + elif api_version == '7.0': + from .v7_0 import models + return models + elif api_version == '7.1-preview': + from .v7_1_preview import models + return models + elif api_version == '7.2-preview': + from .v7_2_preview import models + return models + raise NotImplementedError("APIVersion {} is not available".format(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-keyvault-certificates/azure/keyvault/certificates/_generated/_operations_mixin.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_operations_mixin.py new file mode 100644 index 00000000000..0a5400300cd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_operations_mixin.py @@ -0,0 +1,3148 @@ +# 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 import Serializer, Deserializer +from typing import TYPE_CHECKING +import warnings + +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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union + + +class KeyVaultClientOperationsMixin(object): + + def backup_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Backs up the specified certificate. + + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_certificate') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.backup_certificate(vault_base_url, certificate_name, **kwargs) + + def backup_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.backup_key(vault_base_url, key_name, **kwargs) + + def backup_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + """Backs up the specified secret. + + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.backup_secret(vault_base_url, secret_name, **kwargs) + + def backup_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Backs up the specified storage account. + + Requests that a backup of the specified storage account be downloaded to the client. This + operation requires the storage/backup permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStorageResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_storage_account') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.backup_storage_account(vault_base_url, storage_account_name, **kwargs) + + def create_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Creates a new certificate. + + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('create_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.create_certificate(vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags, **kwargs) + + def create_key( + self, + vault_base_url, # type: str + key_name, # type: str + kty, # type: Union[str, "models.JsonWebKeyType"] + key_size=None, # type: Optional[int] + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + curve=None, # type: Optional[Union[str, "models.JsonWebKeyCurveName"]] + **kwargs # type: Any + ): + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name for the new key. The system will generate the version name for the + new key. + :type key_name: str + :param kty: The type of key to create. For valid values, see JsonWebKeyType. + :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param key_ops: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('create_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.create_key(vault_base_url, key_name, kty, key_size, key_ops, key_attributes, tags, curve, **kwargs) + + def decrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + """Decrypts a single block of encrypted data. + + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('decrypt') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.decrypt(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + def delete_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Deletes a certificate from a specified key vault. + + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_certificate(vault_base_url, certificate_name, **kwargs) + + def delete_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + """Deletes the certificate contacts for a specified key vault. + + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_contacts') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_certificate_contacts(vault_base_url, **kwargs) + + def delete_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + """Deletes the specified certificate issuer. + + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_issuer') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_certificate_issuer(vault_base_url, issuer_name, **kwargs) + + def delete_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Deletes the creation operation for a specific certificate. + + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_operation') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_certificate_operation(vault_base_url, certificate_name, **kwargs) + + def delete_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Deletes a key of any type from storage in Azure Key Vault. + + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + keys/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key to delete. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_key(vault_base_url, key_name, **kwargs) + + def delete_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_sas_definition') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def delete_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + """Deletes a secret from a specified key vault. + + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_secret(vault_base_url, secret_name, **kwargs) + + def delete_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Deletes a storage account. This operation requires the storage/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_storage_account') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.delete_storage_account(vault_base_url, storage_account_name, **kwargs) + + def encrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('encrypt') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.encrypt(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + def get_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + **kwargs # type: Any + ): + """Gets information about a certificate. + + Gets information about a specific certificate. This operation requires the certificates/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. + :type certificate_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate(vault_base_url, certificate_name, certificate_version, **kwargs) + + def get_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + """Lists the certificate contacts for a specified key vault. + + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_contacts') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_contacts(vault_base_url, **kwargs) + + def get_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + """Lists the specified certificate issuer. + + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_issuer') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_issuer(vault_base_url, issuer_name, **kwargs) + + def get_certificate_issuers( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List certificate issuers for a specified key vault. + + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_issuers') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_issuers(vault_base_url, maxresults, **kwargs) + + def get_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Gets the creation operation of a certificate. + + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_operation') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_operation(vault_base_url, certificate_name, **kwargs) + + def get_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Lists the policy for a certificate. + + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in a given key vault. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_policy') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_policy(vault_base_url, certificate_name, **kwargs) + + def get_certificate_versions( + self, + vault_base_url, # type: str + certificate_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List the versions of a certificate. + + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_versions') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_versions(vault_base_url, certificate_name, maxresults, **kwargs) + + def get_certificates( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + """List certificates in a specified key vault. + + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificates') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificates(vault_base_url, maxresults, include_pending, **kwargs) + + def get_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Retrieves information about the specified deleted certificate. + + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + def get_deleted_certificates( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_certificates') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_certificates(vault_base_url, maxresults, include_pending, **kwargs) + + def get_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Gets the public part of a deleted key. + + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_key(vault_base_url, key_name, **kwargs) + + def get_deleted_keys( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """Lists the deleted keys in the specified vault. + + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_keys') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_keys(vault_base_url, maxresults, **kwargs) + + def get_deleted_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + """Gets the specified deleted sas definition. + + The Get Deleted SAS Definition operation returns the specified deleted SAS definition along + with its attributes. This operation requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_sas_definition') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def get_deleted_sas_definitions( + self, + vault_base_url, # type: str + storage_account_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """Lists deleted SAS definitions for the specified vault and storage account. + + The Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_sas_definitions') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_sas_definitions(vault_base_url, storage_account_name, maxresults, **kwargs) + + def get_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + """Gets the specified deleted secret. + + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_secret(vault_base_url, secret_name, **kwargs) + + def get_deleted_secrets( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """Lists deleted secrets for the specified vault. + + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_secrets') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_secrets(vault_base_url, maxresults, **kwargs) + + def get_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Gets the specified deleted storage account. + + The Get Deleted Storage Account operation returns the specified deleted storage account along + with its attributes. This operation requires the storage/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_storage_account') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + def get_deleted_storage_accounts( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """Lists deleted storage accounts for the specified vault. + + The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedStorageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_storage_accounts') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_storage_accounts(vault_base_url, maxresults, **kwargs) + + def get_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + """Gets the public part of a stored key. + + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key to get. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. This + URI fragment is optional. If not specified, the latest version of the key is returned. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_key(vault_base_url, key_name, key_version, **kwargs) + + def get_key_versions( + self, + vault_base_url, # type: str + key_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """Retrieves a list of individual key versions with the same key name. + + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_key_versions') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_key_versions(vault_base_url, key_name, maxresults, **kwargs) + + def get_keys( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List keys in the specified vault. + + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_keys') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_keys(vault_base_url, maxresults, **kwargs) + + def get_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_sas_definition') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def get_sas_definitions( + self, + vault_base_url, # type: str + storage_account_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_sas_definitions') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_sas_definitions(vault_base_url, storage_account_name, maxresults, **kwargs) + + def get_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + **kwargs # type: Any + ): + """Get a specified secret from a given key vault. + + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param secret_version: The version of the secret. This URI fragment is optional. If not + specified, the latest version of the secret is returned. + :type secret_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_secret(vault_base_url, secret_name, secret_version, **kwargs) + + def get_secret_versions( + self, + vault_base_url, # type: str + secret_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List all versions of the specified secret. + + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secret_versions') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_secret_versions(vault_base_url, secret_name, maxresults, **kwargs) + + def get_secrets( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List secrets in a specified key vault. + + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secrets') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_secrets(vault_base_url, maxresults, **kwargs) + + def get_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Gets information about a specified storage account. This operation requires the storage/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_storage_account') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_storage_account(vault_base_url, storage_account_name, **kwargs) + + def get_storage_accounts( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_storage_accounts') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_storage_accounts(vault_base_url, maxresults, **kwargs) + + def import_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + base64_encoded_certificate, # type: str + password=None, # type: Optional[str] + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Imports a certificate into a specified key vault. + + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires + the certificates/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('import_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.import_certificate(vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags, **kwargs) + + def import_key( + self, + vault_base_url, # type: str + key_name, # type: str + key, # type: "models.JsonWebKey" + hsm=None, # type: Optional[bool] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: Name for the imported key. + :type key_name: str + :param key: The Json web key. + :type key: ~azure.keyvault.v7_0.models.JsonWebKey + :param hsm: Whether to import as a hardware key (HSM) or software key. + :type hsm: bool + :param key_attributes: The key management attributes. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('import_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.import_key(vault_base_url, key_name, key, hsm, key_attributes, tags, **kwargs) + + def merge_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + x509_certificates, # type: List[bytearray] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param x509_certificates: The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('merge_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.merge_certificate(vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags, **kwargs) + + def purge_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Permanently deletes the specified deleted certificate. + + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_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 + """ + api_version = self._get_api_version('purge_deleted_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.purge_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + def purge_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Permanently deletes the specified key. + + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_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 + """ + api_version = self._get_api_version('purge_deleted_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.purge_deleted_key(vault_base_url, key_name, **kwargs) + + def purge_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + """Permanently deletes the specified secret. + + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_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 + """ + api_version = self._get_api_version('purge_deleted_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.purge_deleted_secret(vault_base_url, secret_name, **kwargs) + + def purge_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Permanently deletes the specified storage account. + + The purge deleted storage account operation removes the secret permanently, without the + possibility of recovery. This operation can only be performed on a soft-delete enabled vault. + This operation requires the storage/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_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 + """ + api_version = self._get_api_version('purge_deleted_storage_account') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.purge_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + def recover_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.recover_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + def recover_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Recovers the deleted key to its latest version. + + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the deleted key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.recover_deleted_key(vault_base_url, key_name, **kwargs) + + def recover_deleted_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + """Recovers the deleted SAS definition. + + Recovers the deleted SAS definition for the specified storage account. This operation can only + be performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_sas_definition') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.recover_deleted_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def recover_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + """Recovers the deleted secret to the latest version. + + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the deleted secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.recover_deleted_secret(vault_base_url, secret_name, **kwargs) + + def recover_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + """Recovers the deleted storage account. + + Recovers the deleted storage account in the specified vault. This operation can only be + performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_storage_account') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.recover_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + def regenerate_storage_account_key( + self, + vault_base_url, # type: str + storage_account_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param key_name: The storage account key name. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('regenerate_storage_account_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.regenerate_storage_account_key(vault_base_url, storage_account_name, key_name, **kwargs) + + def restore_certificate( + self, + vault_base_url, # type: str + certificate_bundle_backup, # type: bytes + **kwargs # type: Any + ): + """Restores a backed up certificate to a vault. + + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. + :type certificate_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_certificate') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.restore_certificate(vault_base_url, certificate_bundle_backup, **kwargs) + + def restore_key( + self, + vault_base_url, # type: str + key_bundle_backup, # type: bytes + **kwargs # type: Any + ): + """Restores a backed up key to a vault. + + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_bundle_backup: The backup blob associated with a key bundle. + :type key_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.restore_key(vault_base_url, key_bundle_backup, **kwargs) + + def restore_secret( + self, + vault_base_url, # type: str + secret_bundle_backup, # type: bytes + **kwargs # type: Any + ): + """Restores a backed up secret to a vault. + + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_bundle_backup: The backup blob associated with a secret bundle. + :type secret_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.restore_secret(vault_base_url, secret_bundle_backup, **kwargs) + + def restore_storage_account( + self, + vault_base_url, # type: str + storage_bundle_backup, # type: bytes + **kwargs # type: Any + ): + """Restores a backed up storage account to a vault. + + Restores a backed up storage account to a vault. This operation requires the storage/restore + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_bundle_backup: The backup blob associated with a storage account. + :type storage_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_storage_account') + if api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.restore_storage_account(vault_base_url, storage_bundle_backup, **kwargs) + + def set_certificate_contacts( + self, + vault_base_url, # type: str + contact_list=None, # type: Optional[List["models.Contact"]] + **kwargs # type: Any + ): + """Sets the certificate contacts for the specified key vault. + + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_certificate_contacts') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.set_certificate_contacts(vault_base_url, contact_list, **kwargs) + + def set_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider, # type: str + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + """Sets the specified certificate issuer. + + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_certificate_issuer') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.set_certificate_issuer(vault_base_url, issuer_name, provider, credentials, organization_details, attributes, **kwargs) + + def set_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + template_uri, # type: str + sas_type, # type: Union[str, "models.SasTokenType"] + validity_period, # type: str + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. + :type template_uri: str + :param sas_type: The type of SAS token the SAS definition will create. + :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_sas_definition') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.set_sas_definition(vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags, **kwargs) + + def set_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + value, # type: str + tags=None, # type: Optional[Dict[str, str]] + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + **kwargs # type: Any + ): + """Sets a secret in a specified key vault. + + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param value: The value of the secret. + :type value: str + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str + :param secret_attributes: The secret management attributes. + :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.set_secret(vault_base_url, secret_name, value, tags, content_type_parameter, secret_attributes, **kwargs) + + def set_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + resource_id, # type: str + active_key_name, # type: str + auto_regenerate_key, # type: bool + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param resource_id: Storage account resource id. + :type resource_id: str + :param active_key_name: Current active storage account key name. + :type active_key_name: str + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. + :type auto_regenerate_key: bool + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. + :type regeneration_period: str + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_storage_account') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.set_storage_account(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags, **kwargs) + + def sign( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + """Creates a signature from a digest using the specified key. + + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('sign') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.sign(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + def unwrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('unwrap_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.unwrap_key(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + def update_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Updates the specified attributes associated with the given certificate. + + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. + :type certificate_version: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_certificate(vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags, **kwargs) + + def update_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider=None, # type: Optional[str] + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + """Updates the specified certificate issuer. + + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_issuer') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_certificate_issuer(vault_base_url, issuer_name, provider, credentials, organization_details, attributes, **kwargs) + + def update_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + cancellation_requested, # type: bool + **kwargs # type: Any + ): + """Updates a certificate operation. + + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_operation') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_certificate_operation(vault_base_url, certificate_name, cancellation_requested, **kwargs) + + def update_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy, # type: "models.CertificatePolicy" + **kwargs # type: Any + ): + """Updates the policy for a certificate. + + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_policy') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from .v7_1_preview.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from .v7_2_preview.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_certificate_policy(vault_base_url, certificate_name, certificate_policy, **kwargs) + + def update_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of key to update. + :type key_name: str + :param key_version: The version of the key to update. + :type key_version: str + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_key(vault_base_url, key_name, key_version, key_ops, key_attributes, tags, **kwargs) + + def update_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + template_uri=None, # type: Optional[str] + sas_type=None, # type: Optional[Union[str, "models.SasTokenType"]] + validity_period=None, # type: Optional[str] + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. + :type template_uri: str + :param sas_type: The type of SAS token the SAS definition will create. + :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_sas_definition') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_sas_definition(vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags, **kwargs) + + def update_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param secret_version: The version of the secret. + :type secret_version: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str + :param secret_attributes: The secret management attributes. + :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_secret') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_secret(vault_base_url, secret_name, secret_version, content_type_parameter, secret_attributes, tags, **kwargs) + + def update_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + active_key_name=None, # type: Optional[str] + auto_regenerate_key=None, # type: Optional[bool] + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param active_key_name: The current active storage account key name. + :type active_key_name: str + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. + :type auto_regenerate_key: bool + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. + :type regeneration_period: str + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_storage_account') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.update_storage_account(vault_base_url, storage_account_name, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags, **kwargs) + + def verify( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + digest, # type: bytes + signature, # type: bytes + **kwargs # type: Any + ): + """Verifies a signature using a specified key. + + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param digest: The digest used for signing. + :type digest: bytes + :param signature: The signature to be verified. + :type signature: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('verify') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.verify(vault_base_url, key_name, key_version, algorithm, digest, signature, **kwargs) + + def wrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + """Wraps a symmetric key using a specified key. + + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('wrap_key') + if api_version == '2016-10-01': + from .v2016_10_01.operations import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from .v7_0.operations import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.wrap_key(vault_base_url, key_name, key_version, algorithm, value, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_version.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_version.py new file mode 100644 index 00000000000..a30a458f8b5 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/_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 = "0.1.0" \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/version.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/__init__.py similarity index 75% rename from sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/version.py rename to sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/__init__.py index 20ba78005d4..71ceadebe43 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/version.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/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_client_async import KeyVaultClient +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration_async.py new file mode 100644 index 00000000000..07c0d7366f8 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_configuration_async.py @@ -0,0 +1,47 @@ +# 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 KeyVaultClientConfiguration(Configuration): + """Configuration for KeyVaultClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + """ + + def __init__( + self, + **kwargs # type: Any + ) -> None: + # type: (...) -> None + super(KeyVaultClientConfiguration, self).__init__(**kwargs) + + kwargs.setdefault('sdk_moniker', 'azure-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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client_async.py new file mode 100644 index 00000000000..fa8c0816b56 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_key_vault_client_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 azure.core import AsyncPipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration_async import KeyVaultClientConfiguration +from ._operations_mixin_async import KeyVaultClientOperationsMixin +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 KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKClient): + """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + + 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 str api_version: API version to use if no profile is provided, or if + missing in profile. + :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 = '7.0' + _PROFILE_TAG = "azure.keyvault.KeyVaultClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ) -> None: + base_url = '{vaultBaseUrl}' + self._config = KeyVaultClientConfiguration(**kwargs) + self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) + super(KeyVaultClient, self).__init__( + 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` + * 7.0: :mod:`v7_0.models` + * 7.1-preview: :mod:`v7_1_preview.models` + * 7.2-preview: :mod:`v7_2_preview.models` + """ + if api_version == '2016-10-01': + from ..v2016_10_01 import models + return models + elif api_version == '7.0': + from ..v7_0 import models + return models + elif api_version == '7.1-preview': + from ..v7_1_preview import models + return models + elif api_version == '7.2-preview': + from ..v7_2_preview import models + return models + raise NotImplementedError("APIVersion {} is not available".format(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-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin_async.py new file mode 100644 index 00000000000..e55c0d9ebf3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/aio/_operations_mixin_async.py @@ -0,0 +1,3144 @@ +# 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 import Serializer, Deserializer +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, 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 + + +class KeyVaultClientOperationsMixin(object): + + async def backup_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.BackupCertificateResult": + """Backs up the specified certificate. + + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_certificate') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.backup_certificate(vault_base_url, certificate_name, **kwargs) + + async def backup_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.BackupKeyResult": + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.backup_key(vault_base_url, key_name, **kwargs) + + async def backup_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.BackupSecretResult": + """Backs up the specified secret. + + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.backup_secret(vault_base_url, secret_name, **kwargs) + + async def backup_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.BackupStorageResult": + """Backs up the specified storage account. + + Requests that a backup of the specified storage account be downloaded to the client. This + operation requires the storage/backup permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStorageResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('backup_storage_account') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.backup_storage_account(vault_base_url, storage_account_name, **kwargs) + + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateOperation": + """Creates a new certificate. + + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('create_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.create_certificate(vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags, **kwargs) + + async def create_key( + self, + vault_base_url: str, + key_name: str, + kty: Union[str, "models.JsonWebKeyType"], + key_size: Optional[int] = None, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + curve: Optional[Union[str, "models.JsonWebKeyCurveName"]] = None, + **kwargs + ) -> "models.KeyBundle": + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name for the new key. The system will generate the version name for the + new key. + :type key_name: str + :param kty: The type of key to create. For valid values, see JsonWebKeyType. + :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param key_ops: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('create_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.create_key(vault_base_url, key_name, kty, key_size, key_ops, key_attributes, tags, curve, **kwargs) + + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Decrypts a single block of encrypted data. + + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('decrypt') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.decrypt(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + async def delete_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": + """Deletes a certificate from a specified key vault. + + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_certificate(vault_base_url, certificate_name, **kwargs) + + async def delete_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": + """Deletes the certificate contacts for a specified key vault. + + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_contacts') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_certificate_contacts(vault_base_url, **kwargs) + + async def delete_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": + """Deletes the specified certificate issuer. + + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_issuer') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_certificate_issuer(vault_base_url, issuer_name, **kwargs) + + async def delete_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": + """Deletes the creation operation for a specific certificate. + + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_certificate_operation') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_certificate_operation(vault_base_url, certificate_name, **kwargs) + + async def delete_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": + """Deletes a key of any type from storage in Azure Key Vault. + + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + keys/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key to delete. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_key(vault_base_url, key_name, **kwargs) + + async def delete_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.DeletedSasDefinitionBundle": + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_sas_definition') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + async def delete_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": + """Deletes a secret from a specified key vault. + + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_secret(vault_base_url, secret_name, **kwargs) + + async def delete_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.DeletedStorageBundle": + """Deletes a storage account. This operation requires the storage/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('delete_storage_account') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.delete_storage_account(vault_base_url, storage_account_name, **kwargs) + + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('encrypt') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.encrypt(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + async def get_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs + ) -> "models.CertificateBundle": + """Gets information about a certificate. + + Gets information about a specific certificate. This operation requires the certificates/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. + :type certificate_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_certificate(vault_base_url, certificate_name, certificate_version, **kwargs) + + async def get_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": + """Lists the certificate contacts for a specified key vault. + + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_contacts') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_certificate_contacts(vault_base_url, **kwargs) + + async def get_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": + """Lists the specified certificate issuer. + + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_issuer') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_certificate_issuer(vault_base_url, issuer_name, **kwargs) + + def get_certificate_issuers( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.CertificateIssuerListResult"]: + """List certificate issuers for a specified key vault. + + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_issuers') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_issuers(vault_base_url, maxresults, **kwargs) + + async def get_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": + """Gets the creation operation of a certificate. + + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_operation') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_certificate_operation(vault_base_url, certificate_name, **kwargs) + + async def get_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificatePolicy": + """Lists the policy for a certificate. + + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in a given key vault. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_policy') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_certificate_policy(vault_base_url, certificate_name, **kwargs) + + def get_certificate_versions( + self, + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.CertificateListResult"]: + """List the versions of a certificate. + + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificate_versions') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificate_versions(vault_base_url, certificate_name, maxresults, **kwargs) + + def get_certificates( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncItemPaged["models.CertificateListResult"]: + """List certificates in a specified key vault. + + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_certificates') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_certificates(vault_base_url, maxresults, include_pending, **kwargs) + + async def get_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": + """Retrieves information about the specified deleted certificate. + + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + def get_deleted_certificates( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncItemPaged["models.DeletedCertificateListResult"]: + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_certificates') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_certificates(vault_base_url, maxresults, include_pending, **kwargs) + + async def get_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": + """Gets the public part of a deleted key. + + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_deleted_key(vault_base_url, key_name, **kwargs) + + def get_deleted_keys( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.DeletedKeyListResult"]: + """Lists the deleted keys in the specified vault. + + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_keys') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_keys(vault_base_url, maxresults, **kwargs) + + async def get_deleted_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.DeletedSasDefinitionBundle": + """Gets the specified deleted sas definition. + + The Get Deleted SAS Definition operation returns the specified deleted SAS definition along + with its attributes. This operation requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_sas_definition') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_deleted_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def get_deleted_sas_definitions( + self, + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.DeletedSasDefinitionListResult"]: + """Lists deleted SAS definitions for the specified vault and storage account. + + The Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_sas_definitions') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_sas_definitions(vault_base_url, storage_account_name, maxresults, **kwargs) + + async def get_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": + """Gets the specified deleted secret. + + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_deleted_secret(vault_base_url, secret_name, **kwargs) + + def get_deleted_secrets( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.DeletedSecretListResult"]: + """Lists deleted secrets for the specified vault. + + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_secrets') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_secrets(vault_base_url, maxresults, **kwargs) + + async def get_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.DeletedStorageBundle": + """Gets the specified deleted storage account. + + The Get Deleted Storage Account operation returns the specified deleted storage account along + with its attributes. This operation requires the storage/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_storage_account') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + def get_deleted_storage_accounts( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.DeletedStorageListResult"]: + """Lists deleted storage accounts for the specified vault. + + The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedStorageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_deleted_storage_accounts') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_deleted_storage_accounts(vault_base_url, maxresults, **kwargs) + + async def get_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs + ) -> "models.KeyBundle": + """Gets the public part of a stored key. + + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key to get. + :type key_name: str + :param key_version: Adding the version parameter retrieves a specific version of a key. This + URI fragment is optional. If not specified, the latest version of the key is returned. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_key(vault_base_url, key_name, key_version, **kwargs) + + def get_key_versions( + self, + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.KeyListResult"]: + """Retrieves a list of individual key versions with the same key name. + + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_key_versions') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_key_versions(vault_base_url, key_name, maxresults, **kwargs) + + def get_keys( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.KeyListResult"]: + """List keys in the specified vault. + + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_keys') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_keys(vault_base_url, maxresults, **kwargs) + + async def get_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_sas_definition') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + def get_sas_definitions( + self, + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.SasDefinitionListResult"]: + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_sas_definitions') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_sas_definitions(vault_base_url, storage_account_name, maxresults, **kwargs) + + async def get_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs + ) -> "models.SecretBundle": + """Get a specified secret from a given key vault. + + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param secret_version: The version of the secret. This URI fragment is optional. If not + specified, the latest version of the secret is returned. + :type secret_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_secret(vault_base_url, secret_name, secret_version, **kwargs) + + def get_secret_versions( + self, + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.SecretListResult"]: + """List all versions of the specified secret. + + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secret_versions') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_secret_versions(vault_base_url, secret_name, maxresults, **kwargs) + + def get_secrets( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.SecretListResult"]: + """List secrets in a specified key vault. + + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_secrets') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_secrets(vault_base_url, maxresults, **kwargs) + + async def get_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": + """Gets information about a specified storage account. This operation requires the storage/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_storage_account') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.get_storage_account(vault_base_url, storage_account_name, **kwargs) + + def get_storage_accounts( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncItemPaged["models.StorageListResult"]: + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('get_storage_accounts') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return mixin_instance.get_storage_accounts(vault_base_url, maxresults, **kwargs) + + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Imports a certificate into a specified key vault. + + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires + the certificates/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('import_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.import_certificate(vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags, **kwargs) + + async def import_key( + self, + vault_base_url: str, + key_name: str, + key: "models.JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: Name for the imported key. + :type key_name: str + :param key: The Json web key. + :type key: ~azure.keyvault.v7_0.models.JsonWebKey + :param hsm: Whether to import as a hardware key (HSM) or software key. + :type hsm: bool + :param key_attributes: The key management attributes. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('import_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.import_key(vault_base_url, key_name, key, hsm, key_attributes, tags, **kwargs) + + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + x509_certificates: List[bytearray], + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param x509_certificates: The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('merge_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.merge_certificate(vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags, **kwargs) + + async def purge_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> None: + """Permanently deletes the specified deleted certificate. + + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_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 + """ + api_version = self._get_api_version('purge_deleted_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.purge_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + async def purge_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> None: + """Permanently deletes the specified key. + + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_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 + """ + api_version = self._get_api_version('purge_deleted_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.purge_deleted_key(vault_base_url, key_name, **kwargs) + + async def purge_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> None: + """Permanently deletes the specified secret. + + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_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 + """ + api_version = self._get_api_version('purge_deleted_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.purge_deleted_secret(vault_base_url, secret_name, **kwargs) + + async def purge_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> None: + """Permanently deletes the specified storage account. + + The purge deleted storage account operation removes the secret permanently, without the + possibility of recovery. This operation can only be performed on a soft-delete enabled vault. + This operation requires the storage/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_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 + """ + api_version = self._get_api_version('purge_deleted_storage_account') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.purge_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + async def recover_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateBundle": + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.recover_deleted_certificate(vault_base_url, certificate_name, **kwargs) + + async def recover_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.KeyBundle": + """Recovers the deleted key to its latest version. + + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the deleted key. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.recover_deleted_key(vault_base_url, key_name, **kwargs) + + async def recover_deleted_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": + """Recovers the deleted SAS definition. + + Recovers the deleted SAS definition for the specified storage account. This operation can only + be performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_sas_definition') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.recover_deleted_sas_definition(vault_base_url, storage_account_name, sas_definition_name, **kwargs) + + async def recover_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.SecretBundle": + """Recovers the deleted secret to the latest version. + + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the deleted secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.recover_deleted_secret(vault_base_url, secret_name, **kwargs) + + async def recover_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": + """Recovers the deleted storage account. + + Recovers the deleted storage account in the specified vault. This operation can only be + performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('recover_deleted_storage_account') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.recover_deleted_storage_account(vault_base_url, storage_account_name, **kwargs) + + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + key_name: str, + **kwargs + ) -> "models.StorageBundle": + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param key_name: The storage account key name. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('regenerate_storage_account_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.regenerate_storage_account_key(vault_base_url, storage_account_name, key_name, **kwargs) + + async def restore_certificate( + self, + vault_base_url: str, + certificate_bundle_backup: bytes, + **kwargs + ) -> "models.CertificateBundle": + """Restores a backed up certificate to a vault. + + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. + :type certificate_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_certificate') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.restore_certificate(vault_base_url, certificate_bundle_backup, **kwargs) + + async def restore_key( + self, + vault_base_url: str, + key_bundle_backup: bytes, + **kwargs + ) -> "models.KeyBundle": + """Restores a backed up key to a vault. + + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_bundle_backup: The backup blob associated with a key bundle. + :type key_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.restore_key(vault_base_url, key_bundle_backup, **kwargs) + + async def restore_secret( + self, + vault_base_url: str, + secret_bundle_backup: bytes, + **kwargs + ) -> "models.SecretBundle": + """Restores a backed up secret to a vault. + + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_bundle_backup: The backup blob associated with a secret bundle. + :type secret_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.restore_secret(vault_base_url, secret_bundle_backup, **kwargs) + + async def restore_storage_account( + self, + vault_base_url: str, + storage_bundle_backup: bytes, + **kwargs + ) -> "models.StorageBundle": + """Restores a backed up storage account to a vault. + + Restores a backed up storage account to a vault. This operation requires the storage/restore + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_bundle_backup: The backup blob associated with a storage account. + :type storage_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('restore_storage_account') + if api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.restore_storage_account(vault_base_url, storage_bundle_backup, **kwargs) + + async def set_certificate_contacts( + self, + vault_base_url: str, + contact_list: Optional[List["models.Contact"]] = None, + **kwargs + ) -> "models.Contacts": + """Sets the certificate contacts for the specified key vault. + + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_certificate_contacts') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.set_certificate_contacts(vault_base_url, contact_list, **kwargs) + + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: str, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": + """Sets the specified certificate issuer. + + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_certificate_issuer') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.set_certificate_issuer(vault_base_url, issuer_name, provider, credentials, organization_details, attributes, **kwargs) + + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + template_uri: str, + sas_type: Union[str, "models.SasTokenType"], + validity_period: str, + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. + :type template_uri: str + :param sas_type: The type of SAS token the SAS definition will create. + :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_sas_definition') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.set_sas_definition(vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags, **kwargs) + + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + value: str, + tags: Optional[Dict[str, str]] = None, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + **kwargs + ) -> "models.SecretBundle": + """Sets a secret in a specified key vault. + + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param value: The value of the secret. + :type value: str + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str + :param secret_attributes: The secret management attributes. + :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.set_secret(vault_base_url, secret_name, value, tags, content_type_parameter, secret_attributes, **kwargs) + + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + resource_id: str, + active_key_name: str, + auto_regenerate_key: bool, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param resource_id: Storage account resource id. + :type resource_id: str + :param active_key_name: Current active storage account key name. + :type active_key_name: str + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. + :type auto_regenerate_key: bool + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. + :type regeneration_period: str + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('set_storage_account') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.set_storage_account(vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags, **kwargs) + + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Creates a signature from a digest using the specified key. + + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('sign') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.sign(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('unwrap_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.unwrap_key(vault_base_url, key_name, key_version, algorithm, value, **kwargs) + + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Updates the specified attributes associated with the given certificate. + + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. + :type certificate_version: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_certificate(vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags, **kwargs) + + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: Optional[str] = None, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": + """Updates the specified certificate issuer. + + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_issuer') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_certificate_issuer(vault_base_url, issuer_name, provider, credentials, organization_details, attributes, **kwargs) + + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + cancellation_requested: bool, + **kwargs + ) -> "models.CertificateOperation": + """Updates a certificate operation. + + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_operation') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_certificate_operation(vault_base_url, certificate_name, cancellation_requested, **kwargs) + + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: "models.CertificatePolicy", + **kwargs + ) -> "models.CertificatePolicy": + """Updates the policy for a certificate. + + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_certificate_policy') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.1-preview': + from ..v7_1_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.2-preview': + from ..v7_2_preview.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_certificate_policy(vault_base_url, certificate_name, certificate_policy, **kwargs) + + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of key to update. + :type key_name: str + :param key_version: The version of the key to update. + :type key_version: str + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. + :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_key(vault_base_url, key_name, key_version, key_ops, key_attributes, tags, **kwargs) + + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + template_uri: Optional[str] = None, + sas_type: Optional[Union[str, "models.SasTokenType"]] = None, + validity_period: Optional[str] = None, + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param sas_definition_name: The name of the SAS definition. + :type sas_definition_name: str + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. + :type template_uri: str + :param sas_type: The type of SAS token the SAS definition will create. + :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_sas_definition') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_sas_definition(vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags, **kwargs) + + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SecretBundle": + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param secret_name: The name of the secret. + :type secret_name: str + :param secret_version: The version of the secret. + :type secret_version: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str + :param secret_attributes: The secret management attributes. + :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.SecretBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_secret') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_secret(vault_base_url, secret_name, secret_version, content_type_parameter, secret_attributes, tags, **kwargs) + + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + active_key_name: Optional[str] = None, + auto_regenerate_key: Optional[bool] = None, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param storage_account_name: The name of the storage account. + :type storage_account_name: str + :param active_key_name: The current active storage account key name. + :type active_key_name: str + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. + :type auto_regenerate_key: bool + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. + :type regeneration_period: str + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.StorageBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('update_storage_account') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.update_storage_account(vault_base_url, storage_account_name, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags, **kwargs) + + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, + **kwargs + ) -> "models.KeyVerifyResult": + """Verifies a signature using a specified key. + + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param digest: The digest used for signing. + :type digest: bytes + :param signature: The signature to be verified. + :type signature: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('verify') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.verify(vault_base_url, key_name, key_version, algorithm, digest, signature, **kwargs) + + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Wraps a symmetric key using a specified key. + + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param key_name: The name of the key. + :type key_name: str + :param key_version: The version of the key. + :type key_version: str + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param value: + :type value: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = self._get_api_version('wrap_key') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + elif api_version == '7.0': + from ..v7_0.aio.operations_async import KeyVaultClientOperationsMixin as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + mixin_instance = OperationClass() + mixin_instance._client = self._client + mixin_instance._config = self._config + mixin_instance._serialize = Serializer(self._models_dict(api_version)) + mixin_instance._deserialize = Deserializer(self._models_dict(api_version)) + return await mixin_instance.wrap_key(vault_base_url, key_name, key_version, algorithm, value, **kwargs) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/models.py new file mode 100644 index 00000000000..c23fcf93db2 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/models.py @@ -0,0 +1,7 @@ +# 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. +# -------------------------------------------------------------------------- +from .v7_0.models import * diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/py.typed b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/__init__.py index e913d4cf6c4..a6c1f9b7a79 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/__init__.py @@ -1,18 +1,16 @@ # 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 ._key_vault_client import KeyVaultClient __all__ = ['KeyVaultClient'] -from .version import VERSION - -__version__ = VERSION - +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_configuration.py index 68d6f5b6bd2..2a8840521dd 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_configuration.py @@ -1,43 +1,46 @@ # 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 TYPE_CHECKING + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from .version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "2016-10-01" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +48,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_key_vault_client.py index e3ec609b6cd..d9db79ab878 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_key_vault_client.py @@ -1,16 +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. -# +# 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 TYPE_CHECKING + from azure.core import PipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin @@ -20,27 +23,32 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs # type: Any + ): + # type: (...) -> None base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = PipelineClient(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) + def close(self): + # type: () -> None + self._client.close() + def __enter__(self): + # type: () -> KeyVaultClient self._client.__enter__() return self + def __exit__(self, *exc_details): + # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_metadata.json new file mode 100644 index 00000000000..e860c3e3dcd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/_metadata.json @@ -0,0 +1,837 @@ +{ + "chosen_version": "2016-10-01", + "total_api_version_list": ["2016-10-01"], + "client": { + "name": "KeyVaultClient", + "filename": "_key_vault_client", + "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", + "base_url": null, + "custom_base_url": "\u0027{vaultBaseUrl}\u0027", + "azure_arm": false + }, + "global_parameters": { + "sync_method": { + }, + "async_method": { + }, + "constant": { + }, + "call": "" + }, + "config": { + "credential": false, + "credential_scopes": null, + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + }, + "operation_mixins": { + "create_key" : { + "sync": { + "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n kty, # type: Union[str, \"models.JsonWebKeyType\"]\n key_size=None, # type: Optional[int]\n key_ops=None, # type: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n curve=None, # type: Optional[Union[str, \"models.JsonWebKeyCurveName\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new key, stores it, then returns key parameters and attributes to the client.\n\nThe create key operation can be used to create any key type in Azure Key Vault. If the named\nkey already exists, Azure Key Vault creates a new version of the key. It requires the\nkeys/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name for the new key. The system will generate the version name for the\n new key.\n:type key_name: str\n:param kty: The type of key to create. For valid values, see JsonWebKeyType.\n:type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType\n:param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA.\n:type key_size: int\n:param key_ops:\n:type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName.\n:type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n kty: Union[str, \"models.JsonWebKeyType\"],\n key_size: Optional[int] = None,\n key_ops: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n curve: Optional[Union[str, \"models.JsonWebKeyCurveName\"]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Creates a new key, stores it, then returns key parameters and attributes to the client.\n\nThe create key operation can be used to create any key type in Azure Key Vault. If the named\nkey already exists, Azure Key Vault creates a new version of the key. It requires the\nkeys/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name for the new key. The system will generate the version name for the\n new key.\n:type key_name: str\n:param kty: The type of key to create. For valid values, see JsonWebKeyType.\n:type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType\n:param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA.\n:type key_size: int\n:param key_ops:\n:type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName.\n:type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, kty, key_size, key_ops, key_attributes, tags, curve" + }, + "import_key" : { + "sync": { + "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key, # type: \"models.JsonWebKey\"\n hsm=None, # type: Optional[bool]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the client.\n\nThe import key operation may be used to import any key type into an Azure Key Vault. If the\nnamed key already exists, Azure Key Vault creates a new version of the key. This operation\nrequires the keys/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: Name for the imported key.\n:type key_name: str\n:param key: The Json web key.\n:type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey\n:param hsm: Whether to import as a hardware key (HSM) or software key.\n:type hsm: bool\n:param key_attributes: The key management attributes.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n key: \"models.JsonWebKey\",\n hsm: Optional[bool] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the client.\n\nThe import key operation may be used to import any key type into an Azure Key Vault. If the\nnamed key already exists, Azure Key Vault creates a new version of the key. This operation\nrequires the keys/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: Name for the imported key.\n:type key_name: str\n:param key: The Json web key.\n:type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey\n:param hsm: Whether to import as a hardware key (HSM) or software key.\n:type hsm: bool\n:param key_attributes: The key management attributes.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key, hsm, key_attributes, tags" + }, + "delete_key" : { + "sync": { + "signature": "def delete_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a key of any type from storage in Azure Key Vault.\n\nThe delete key operation cannot be used to remove individual versions of a key. This operation\nremoves the cryptographic material associated with the key, which means the key is not usable\nfor Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the\nkeys/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to delete.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.DeletedKeyBundle\":\n", + "doc": "\"\"\"Deletes a key of any type from storage in Azure Key Vault.\n\nThe delete key operation cannot be used to remove individual versions of a key. This operation\nremoves the cryptographic material associated with the key, which means the key is not usable\nfor Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the\nkeys/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to delete.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "update_key" : { + "sync": { + "signature": "def update_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n key_ops=None, # type: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault.\n\nIn order to perform this operation, the key must already exist in the Key Vault. Note: The\ncryptographic material of a key itself cannot be changed. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of key to update.\n:type key_name: str\n:param key_version: The version of the key to update.\n:type key_version: str\n:param key_ops: Json web key operations. For more information on possible key operations, see\n JsonWebKeyOperation.\n:type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n key_ops: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault.\n\nIn order to perform this operation, the key must already exist in the Key Vault. Note: The\ncryptographic material of a key itself cannot be changed. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of key to update.\n:type key_name: str\n:param key_version: The version of the key to update.\n:type key_version: str\n:param key_ops: Json web key operations. For more information on possible key operations, see\n JsonWebKeyOperation.\n:type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, key_ops, key_attributes, tags" + }, + "get_key" : { + "sync": { + "signature": "def get_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the public part of a stored key.\n\nThe get key operation is applicable to all key types. If the requested key is symmetric, then\nno key material is released in the response. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to get.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n:type key_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Gets the public part of a stored key.\n\nThe get key operation is applicable to all key types. If the requested key is symmetric, then\nno key material is released in the response. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to get.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key.\n:type key_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version" + }, + "get_key_versions" : { + "sync": { + "signature": "def get_key_versions(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves a list of individual key versions with the same key name.\n\nThe full key identifier, attributes, and tags are provided in the response. This operation\nrequires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.KeyListResult\"]:\n", + "doc": "\"\"\"Retrieves a list of individual key versions with the same key name.\n\nThe full key identifier, attributes, and tags are provided in the response. This operation\nrequires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, maxresults" + }, + "get_keys" : { + "sync": { + "signature": "def get_keys(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a stored key. The LIST operation is applicable to all key types, however only\nthe base key identifier, attributes, and tags are provided in the response. Individual versions\nof a key are not listed in the response. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.KeyListResult\"]:\n", + "doc": "\"\"\"List keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a stored key. The LIST operation is applicable to all key types, however only\nthe base key identifier, attributes, and tags are provided in the response. Individual versions\nof a key are not listed in the response. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "backup_key" : { + "sync": { + "signature": "def backup_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Requests that a backup of the specified key be downloaded to the client.\n\nThe Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this\noperation does NOT return key material in a form that can be used outside the Azure Key Vault\nsystem, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key\nVault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure\nKey Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance.\nThe BACKUP operation may be used to export, in protected form, any key type from Azure Key\nVault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed\nwithin geographical boundaries only; meaning that a BACKUP from one geographical area cannot be\nrestored to another geographical area. For example, a backup from the US geographical area\ncannot be restored in an EU geographical area. This operation requires the key/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupKeyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.BackupKeyResult\":\n", + "doc": "\"\"\"Requests that a backup of the specified key be downloaded to the client.\n\nThe Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this\noperation does NOT return key material in a form that can be used outside the Azure Key Vault\nsystem, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key\nVault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure\nKey Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance.\nThe BACKUP operation may be used to export, in protected form, any key type from Azure Key\nVault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed\nwithin geographical boundaries only; meaning that a BACKUP from one geographical area cannot be\nrestored to another geographical area. For example, a backup from the US geographical area\ncannot be restored in an EU geographical area. This operation requires the key/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupKeyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "restore_key" : { + "sync": { + "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n key_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up key to a vault.\n\nImports a previously backed up key into Azure Key Vault, restoring the key, its key identifier,\nattributes and access control policies. The RESTORE operation may be used to import a\npreviously backed up key. Individual versions of a key cannot be restored. The key is restored\nin its entirety with the same key name as it had when it was backed up. If the key name is not\navailable in the target Key Vault, the RESTORE operation will be rejected. While the key name\nis retained during restore, the final key identifier will change if the key is restored to a\ndifferent vault. Restore will restore all versions and preserve version identifiers. The\nRESTORE operation is subject to security constraints: The target Key Vault must be owned by the\nsame Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission\nin the target Key Vault. This operation requires the keys/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_bundle_backup: The backup blob associated with a key bundle.\n:type key_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n key_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Restores a backed up key to a vault.\n\nImports a previously backed up key into Azure Key Vault, restoring the key, its key identifier,\nattributes and access control policies. The RESTORE operation may be used to import a\npreviously backed up key. Individual versions of a key cannot be restored. The key is restored\nin its entirety with the same key name as it had when it was backed up. If the key name is not\navailable in the target Key Vault, the RESTORE operation will be rejected. While the key name\nis retained during restore, the final key identifier will change if the key is restored to a\ndifferent vault. Restore will restore all versions and preserve version identifiers. The\nRESTORE operation is subject to security constraints: The target Key Vault must be owned by the\nsame Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission\nin the target Key Vault. This operation requires the keys/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_bundle_backup: The backup blob associated with a key bundle.\n:type key_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_bundle_backup" + }, + "encrypt" : { + "sync": { + "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault.\n\nThe ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is\nstored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of\ndata, the size of which is dependent on the target key and the encryption algorithm to be used.\nThe ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault\nsince protection with an asymmetric key can be performed using public portion of the key. This\noperation is supported for asymmetric keys as a convenience for callers that have a key-\nreference but do not have access to the public key material. This operation requires the\nkeys/encrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault.\n\nThe ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is\nstored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of\ndata, the size of which is dependent on the target key and the encryption algorithm to be used.\nThe ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault\nsince protection with an asymmetric key can be performed using public portion of the key. This\noperation is supported for asymmetric keys as a convenience for callers that have a key-\nreference but do not have access to the public key material. This operation requires the\nkeys/encrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "decrypt" : { + "sync": { + "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Decrypts a single block of encrypted data.\n\nThe DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption\nkey and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a\nsingle block of data may be decrypted, the size of this block is dependent on the target key\nand the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys\nstored in Azure Key Vault since it uses the private portion of the key. This operation requires\nthe keys/decrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Decrypts a single block of encrypted data.\n\nThe DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption\nkey and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a\nsingle block of data may be decrypted, the size of this block is dependent on the target key\nand the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys\nstored in Azure Key Vault since it uses the private portion of the key. This operation requires\nthe keys/decrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "sign" : { + "sync": { + "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeySignatureAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a signature from a digest using the specified key.\n\nThe SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault\nsince this operation uses the private portion of the key. This operation requires the keys/sign\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm identifier. For more information on\n possible algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeySignatureAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Creates a signature from a digest using the specified key.\n\nThe SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault\nsince this operation uses the private portion of the key. This operation requires the keys/sign\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm identifier. For more information on\n possible algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "verify" : { + "sync": { + "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeySignatureAlgorithm\"]\n digest, # type: bytes\n signature, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Verifies a signature using a specified key.\n\nThe VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not\nstrictly necessary for asymmetric keys stored in Azure Key Vault since signature verification\ncan be performed using the public portion of the key but this operation is supported as a\nconvenience for callers that only have a key-reference and not the public portion of the key.\nThis operation requires the keys/verify permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm. For more information on possible\n algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm\n:param digest: The digest used for signing.\n:type digest: bytes\n:param signature: The signature to be verified.\n:type signature: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyVerifyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeySignatureAlgorithm\"],\n digest: bytes,\n signature: bytes,\n **kwargs\n) -\u003e \"models.KeyVerifyResult\":\n", + "doc": "\"\"\"Verifies a signature using a specified key.\n\nThe VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not\nstrictly necessary for asymmetric keys stored in Azure Key Vault since signature verification\ncan be performed using the public portion of the key but this operation is supported as a\nconvenience for callers that only have a key-reference and not the public portion of the key.\nThis operation requires the keys/verify permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm. For more information on possible\n algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm\n:param digest: The digest used for signing.\n:type digest: bytes\n:param signature: The signature to be verified.\n:type signature: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyVerifyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, digest, signature" + }, + "wrap_key" : { + "sync": { + "signature": "def wrap_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Wraps a symmetric key using a specified key.\n\nThe WRAP operation supports encryption of a symmetric key using a key encryption key that has\npreviously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for\nsymmetric keys stored in Azure Key Vault since protection with an asymmetric key can be\nperformed using the public portion of the key. This operation is supported for asymmetric keys\nas a convenience for callers that have a key-reference but do not have access to the public key\nmaterial. This operation requires the keys/wrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Wraps a symmetric key using a specified key.\n\nThe WRAP operation supports encryption of a symmetric key using a key encryption key that has\npreviously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for\nsymmetric keys stored in Azure Key Vault since protection with an asymmetric key can be\nperformed using the public portion of the key. This operation is supported for asymmetric keys\nas a convenience for callers that have a key-reference but do not have access to the public key\nmaterial. This operation requires the keys/wrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "unwrap_key" : { + "sync": { + "signature": "def unwrap_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Unwraps a symmetric key using the specified key that was initially used for wrapping that key.\n\nThe UNWRAP operation supports decryption of a symmetric key using the target key encryption\nkey. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to\nasymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of\nthe key. This operation requires the keys/unwrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Unwraps a symmetric key using the specified key that was initially used for wrapping that key.\n\nThe UNWRAP operation supports decryption of a symmetric key using the target key encryption\nkey. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to\nasymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of\nthe key. This operation requires the keys/unwrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "get_deleted_keys" : { + "sync": { + "signature": "def get_deleted_keys(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a deleted key. This operation includes deletion-specific information. The Get\nDeleted Keys operation is applicable for vaults enabled for soft-delete. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedKeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedKeyListResult\"]:\n", + "doc": "\"\"\"Lists the deleted keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a deleted key. This operation includes deletion-specific information. The Get\nDeleted Keys operation is applicable for vaults enabled for soft-delete. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedKeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_key" : { + "sync": { + "signature": "def get_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the public part of a deleted key.\n\nThe Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.DeletedKeyBundle\":\n", + "doc": "\"\"\"Gets the public part of a deleted key.\n\nThe Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "purge_deleted_key" : { + "sync": { + "signature": "def purge_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified key.\n\nThe Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the\noperation can be invoked on any vault, it will return an error if invoked on a non soft-delete\nenabled vault. This operation requires the keys/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified key.\n\nThe Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the\noperation can be invoked on any vault, it will return an error if invoked on a non soft-delete\nenabled vault. This operation requires the keys/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "recover_deleted_key" : { + "sync": { + "signature": "def recover_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted key to its latest version.\n\nThe Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults.\nIt recovers the deleted key back to its latest version under /keys. An attempt to recover an\nnon-deleted key will return an error. Consider this the inverse of the delete operation on\nsoft-delete enabled vaults. This operation requires the keys/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the deleted key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Recovers the deleted key to its latest version.\n\nThe Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults.\nIt recovers the deleted key back to its latest version under /keys. An attempt to recover an\nnon-deleted key will return an error. Consider this the inverse of the delete operation on\nsoft-delete enabled vaults. This operation requires the keys/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the deleted key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "set_secret" : { + "sync": { + "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n value, # type: str\n tags=None, # type: Optional[Dict[str, str]]\n content_type_parameter=None, # type: Optional[str]\n secret_attributes=None, # type: Optional[\"models.SecretAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets a secret in a specified key vault.\n\nThe SET operation adds a secret to the Azure Key Vault. If the named secret already exists,\nAzure Key Vault creates a new version of that secret. This operation requires the secrets/set\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param value: The value of the secret.\n:type value: str\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n value: str,\n tags: Optional[Dict[str, str]] = None,\n content_type_parameter: Optional[str] = None,\n secret_attributes: Optional[\"models.SecretAttributes\"] = None,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Sets a secret in a specified key vault.\n\nThe SET operation adds a secret to the Azure Key Vault. If the named secret already exists,\nAzure Key Vault creates a new version of that secret. This operation requires the secrets/set\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param value: The value of the secret.\n:type value: str\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, value, tags, content_type_parameter, secret_attributes" + }, + "delete_secret" : { + "sync": { + "signature": "def delete_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a secret from a specified key vault.\n\nThe DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied\nto an individual version of a secret. This operation requires the secrets/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.DeletedSecretBundle\":\n", + "doc": "\"\"\"Deletes a secret from a specified key vault.\n\nThe DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied\nto an individual version of a secret. This operation requires the secrets/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "update_secret" : { + "sync": { + "signature": "def update_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n secret_version, # type: str\n content_type_parameter=None, # type: Optional[str]\n secret_attributes=None, # type: Optional[\"models.SecretAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the attributes associated with a specified secret in a given key vault.\n\nThe UPDATE operation changes specified attributes of an existing stored secret. Attributes that\nare not specified in the request are left unchanged. The value of a secret itself cannot be\nchanged. This operation requires the secrets/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n content_type_parameter: Optional[str] = None,\n secret_attributes: Optional[\"models.SecretAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Updates the attributes associated with a specified secret in a given key vault.\n\nThe UPDATE operation changes specified attributes of an existing stored secret. Attributes that\nare not specified in the request are left unchanged. The value of a secret itself cannot be\nchanged. This operation requires the secrets/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, secret_version, content_type_parameter, secret_attributes, tags" + }, + "get_secret" : { + "sync": { + "signature": "def get_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n secret_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get a specified secret from a given key vault.\n\nThe GET operation is applicable to any secret stored in Azure Key Vault. This operation\nrequires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Get a specified secret from a given key vault.\n\nThe GET operation is applicable to any secret stored in Azure Key Vault. This operation\nrequires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, secret_version" + }, + "get_secrets" : { + "sync": { + "signature": "def get_secrets(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List secrets in a specified key vault.\n\nThe Get Secrets operation is applicable to the entire vault. However, only the base secret\nidentifier and its attributes are provided in the response. Individual secret versions are not\nlisted in the response. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SecretListResult\"]:\n", + "doc": "\"\"\"List secrets in a specified key vault.\n\nThe Get Secrets operation is applicable to the entire vault. However, only the base secret\nidentifier and its attributes are provided in the response. Individual secret versions are not\nlisted in the response. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_secret_versions" : { + "sync": { + "signature": "def get_secret_versions(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all versions of the specified secret.\n\nThe full secret identifier and attributes are provided in the response. No values are returned\nfor the secrets. This operations requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SecretListResult\"]:\n", + "doc": "\"\"\"List all versions of the specified secret.\n\nThe full secret identifier and attributes are provided in the response. No values are returned\nfor the secrets. This operations requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, maxresults" + }, + "get_deleted_secrets" : { + "sync": { + "signature": "def get_deleted_secrets(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists deleted secrets for the specified vault.\n\nThe Get Deleted Secrets operation returns the secrets that have been deleted for a vault\nenabled for soft-delete. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedSecretListResult\"]:\n", + "doc": "\"\"\"Lists deleted secrets for the specified vault.\n\nThe Get Deleted Secrets operation returns the secrets that have been deleted for a vault\nenabled for soft-delete. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_secret" : { + "sync": { + "signature": "def get_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the specified deleted secret.\n\nThe Get Deleted Secret operation returns the specified deleted secret along with its\nattributes. This operation requires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.DeletedSecretBundle\":\n", + "doc": "\"\"\"Gets the specified deleted secret.\n\nThe Get Deleted Secret operation returns the specified deleted secret along with its\nattributes. This operation requires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "purge_deleted_secret" : { + "sync": { + "signature": "def purge_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified secret.\n\nThe purge deleted secret operation removes the secret permanently, without the possibility of\nrecovery. This operation can only be enabled on a soft-delete enabled vault. This operation\nrequires the secrets/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified secret.\n\nThe purge deleted secret operation removes the secret permanently, without the possibility of\nrecovery. This operation can only be enabled on a soft-delete enabled vault. This operation\nrequires the secrets/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "recover_deleted_secret" : { + "sync": { + "signature": "def recover_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted secret to the latest version.\n\nRecovers the deleted secret in the specified vault. This operation can only be performed on a\nsoft-delete enabled vault. This operation requires the secrets/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Recovers the deleted secret to the latest version.\n\nRecovers the deleted secret in the specified vault. This operation can only be performed on a\nsoft-delete enabled vault. This operation requires the secrets/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "backup_secret" : { + "sync": { + "signature": "def backup_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified secret.\n\nRequests that a backup of the specified secret be downloaded to the client. All versions of the\nsecret will be downloaded. This operation requires the secrets/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupSecretResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.BackupSecretResult\":\n", + "doc": "\"\"\"Backs up the specified secret.\n\nRequests that a backup of the specified secret be downloaded to the client. All versions of the\nsecret will be downloaded. This operation requires the secrets/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupSecretResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "restore_secret" : { + "sync": { + "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n secret_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up secret to a vault.\n\nRestores a backed up secret, and all its versions, to a vault. This operation requires the\nsecrets/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_bundle_backup: The backup blob associated with a secret bundle.\n:type secret_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n secret_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Restores a backed up secret to a vault.\n\nRestores a backed up secret, and all its versions, to a vault. This operation requires the\nsecrets/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_bundle_backup: The backup blob associated with a secret bundle.\n:type secret_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_bundle_backup" + }, + "get_certificates" : { + "sync": { + "signature": "def get_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "delete_certificate" : { + "sync": { + "signature": "def delete_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "set_certificate_contacts" : { + "sync": { + "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contact_list=None, # type: Optional[List[\"models.Contact\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v2016_10_01.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contact_list: Optional[List[\"models.Contact\"]] = None,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v2016_10_01.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, contact_list" + }, + "get_certificate_contacts" : { + "sync": { + "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "delete_certificate_contacts" : { + "sync": { + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "get_certificate_issuers" : { + "sync": { + "signature": "def get_certificate_issuers(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateIssuerListResult\"]:\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "set_certificate_issuer" : { + "sync": { + "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider, # type: str\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: str,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "update_certificate_issuer" : { + "sync": { + "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider=None, # type: Optional[str]\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: Optional[str] = None,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "get_certificate_issuer" : { + "sync": { + "signature": "def get_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "delete_certificate_issuer" : { + "sync": { + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "create_certificate" : { + "sync": { + "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags" + }, + "import_certificate" : { + "sync": { + "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n base64_encoded_certificate, # type: str\n password=None, # type: Optional[str]\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n base64_encoded_certificate: str,\n password: Optional[str] = None,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags" + }, + "get_certificate_versions" : { + "sync": { + "signature": "def get_certificate_versions(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, maxresults" + }, + "get_certificate_policy" : { + "sync": { + "signature": "def get_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "update_certificate_policy" : { + "sync": { + "signature": "def update_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy, # type: \"models.CertificatePolicy\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: \"models.CertificatePolicy\",\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy" + }, + "update_certificate" : { + "sync": { + "signature": "def update_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags" + }, + "get_certificate" : { + "sync": { + "signature": "def get_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version" + }, + "update_certificate_operation" : { + "sync": { + "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n cancellation_requested, # type: bool\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n cancellation_requested: bool,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, cancellation_requested" + }, + "get_certificate_operation" : { + "sync": { + "signature": "def get_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "delete_certificate_operation" : { + "sync": { + "signature": "def delete_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "merge_certificate" : { + "sync": { + "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n x509_certificates, # type: List[bytearray]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n x509_certificates: List[bytearray],\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags" + }, + "get_deleted_certificates" : { + "sync": { + "signature": "def get_deleted_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedCertificateListResult\"]:\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_certificate" : { + "sync": { + "signature": "def get_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "purge_deleted_certificate" : { + "sync": { + "signature": "def purge_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "recover_deleted_certificate" : { + "sync": { + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "get_storage_accounts" : { + "sync": { + "signature": "def get_storage_accounts(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List storage accounts managed by the specified key vault. This operation requires the\nstorage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either StorageListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.StorageListResult\"]:\n", + "doc": "\"\"\"List storage accounts managed by the specified key vault. This operation requires the\nstorage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either StorageListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "delete_storage_account" : { + "sync": { + "signature": "def delete_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a storage account. This operation requires the storage/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Deletes a storage account. This operation requires the storage/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "get_storage_account" : { + "sync": { + "signature": "def get_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a specified storage account. This operation requires the storage/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Gets information about a specified storage account. This operation requires the storage/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "set_storage_account" : { + "sync": { + "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n resource_id, # type: str\n active_key_name, # type: str\n auto_regenerate_key, # type: bool\n regeneration_period=None, # type: Optional[str]\n storage_account_attributes=None, # type: Optional[\"models.StorageAccountAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates or updates a new storage account. This operation requires the storage/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param resource_id: Storage account resource id.\n:type resource_id: str\n:param active_key_name: Current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n resource_id: str,\n active_key_name: str,\n auto_regenerate_key: bool,\n regeneration_period: Optional[str] = None,\n storage_account_attributes: Optional[\"models.StorageAccountAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Creates or updates a new storage account. This operation requires the storage/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param resource_id: Storage account resource id.\n:type resource_id: str\n:param active_key_name: Current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags" + }, + "update_storage_account" : { + "sync": { + "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n active_key_name=None, # type: Optional[str]\n auto_regenerate_key=None, # type: Optional[bool]\n regeneration_period=None, # type: Optional[str]\n storage_account_attributes=None, # type: Optional[\"models.StorageAccountAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given storage account. This operation\nrequires the storage/set/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param active_key_name: The current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n active_key_name: Optional[str] = None,\n auto_regenerate_key: Optional[bool] = None,\n regeneration_period: Optional[str] = None,\n storage_account_attributes: Optional[\"models.StorageAccountAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given storage account. This operation\nrequires the storage/set/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param active_key_name: The current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags" + }, + "regenerate_storage_account_key" : { + "sync": { + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Regenerates the specified key value for the given storage account. This operation requires the\nstorage/regeneratekey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param key_name: The storage account key name.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Regenerates the specified key value for the given storage account. This operation requires the\nstorage/regeneratekey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param key_name: The storage account key name.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, key_name" + }, + "get_sas_definitions" : { + "sync": { + "signature": "def get_sas_definitions(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List storage SAS definitions for the given storage account. This operation requires the\nstorage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SasDefinitionListResult\"]:\n", + "doc": "\"\"\"List storage SAS definitions for the given storage account. This operation requires the\nstorage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, maxresults" + }, + "delete_sas_definition" : { + "sync": { + "signature": "def delete_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a SAS definition from a specified storage account. This operation requires the\nstorage/deletesas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Deletes a SAS definition from a specified storage account. This operation requires the\nstorage/deletesas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "get_sas_definition" : { + "sync": { + "signature": "def get_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a SAS definition for the specified storage account. This operation\nrequires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Gets information about a SAS definition for the specified storage account. This operation\nrequires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "set_sas_definition" : { + "sync": { + "signature": "def set_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n parameters, # type: Dict[str, str]\n sas_definition_attributes=None, # type: Optional[\"models.SasDefinitionAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates or updates a new SAS definition for the specified storage account. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param parameters: Sas definition creation metadata in the form of key-value pairs.\n:type parameters: dict[str, str]\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Dict[str, str],\n sas_definition_attributes: Optional[\"models.SasDefinitionAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Creates or updates a new SAS definition for the specified storage account. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param parameters: Sas definition creation metadata in the form of key-value pairs.\n:type parameters: dict[str, str]\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes, tags" + }, + "update_sas_definition" : { + "sync": { + "signature": "def update_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n parameters=None, # type: Optional[Dict[str, str]]\n sas_definition_attributes=None, # type: Optional[\"models.SasDefinitionAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given SAS definition. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param parameters: Sas definition update metadata in the form of key-value pairs.\n:type parameters: dict[str, str]\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n parameters: Optional[Dict[str, str]] = None,\n sas_definition_attributes: Optional[\"models.SasDefinitionAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given SAS definition. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param parameters: Sas definition update metadata in the form of key-value pairs.\n:type parameters: dict[str, str]\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes, tags" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/__init__.py index fb2e6c3866f..71ceadebe43 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/__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 ._key_vault_client_async import KeyVaultClient diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration_async.py index fb961bb4bd2..3f9c256ec9e 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_configuration_async.py @@ -1,43 +1,40 @@ # 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 + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from ..version import VERSION - +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs: Any + ) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "2016-10-01" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +42,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client_async.py index ad4b8a97754..2d273c4e45f 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/_key_vault_client_async.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 typing import Any + from azure.core import AsyncPipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer from ._configuration_async import KeyVaultClientConfiguration from .operations_async import KeyVaultClientOperationsMixin @@ -20,27 +19,28 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs: Any + ) -> None: base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = AsyncPipelineClient(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) - async def __aenter__(self): + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/__init__.py index 771a17ceb80..b887c97a420 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/__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 ._key_vault_client_operations_async import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py index 2e34320ea0f..8fe1d19ef89 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py @@ -1,3940 +1,4158 @@ # 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, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings -from azure.core.exceptions import map_error 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 ... import models -import uuid +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeyVaultClientOperationsMixin: - async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, *, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. - - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + async def create_key( + self, + vault_base_url: str, + key_name: str, + kty: Union[str, "models.JsonWebKeyType"], + key_size: Optional[int] = None, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + curve: Optional[Union[str, "models.JsonWebKeyCurveName"]] = None, + **kwargs + ) -> "models.KeyBundle": + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. + :param key_name: The name for the new key. The system will generate the version name for the + new key. :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' + :param kty: The type of key to create. For valid values, see JsonWebKeyType. :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'SECP256K1' - :type curve: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + :type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_key.metadata['url'] + url = self.create_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + create_key.metadata = {'url': '/keys/{key-name}/create'} # type: ignore + + async def import_key( + self, + vault_base_url: str, + key_name: str, + key: "models.JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: Name for the imported key. :type key_name: str - :param key: The Json web key + :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_key.metadata['url'] + url = self.import_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + import_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + async def delete_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": """Deletes a key of any type from storage in Azure Key Vault. - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the keys/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to delete. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_key.metadata['url'] + url = self.delete_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} - - async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. - - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of key to update. :type key_name: str :param key_version: The version of the key to update. :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_key.metadata['url'] + url = self.update_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kwargs): + update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore + + async def get_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs + ) -> "models.KeyBundle": """Gets the public part of a stored key. - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to get. :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. + :param key_version: Adding the version parameter retrieves a specific version of a key. :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_key.metadata['url'] + url = self.get_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} + get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore def get_key_versions( - self, vault_base_url, key_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.KeyListResult"]: """Retrieves a list of individual key versions with the same key name. - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_key_versions.metadata['url'] + url = self.get_key_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'key-name': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} + get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} # type: ignore def get_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.KeyListResult"]: """List keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_keys.metadata['url'] + url = self.get_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_keys.metadata = {'url': '/keys'} - - async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_keys.metadata = {'url': '/keys'} # type: ignore + + async def backup_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.BackupKeyResult": + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupKeyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.backup_key.metadata['url'] + url = self.backup_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) + deserialized = self._deserialize('BackupKeyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kwargs): + backup_key.metadata = {'url': '/keys/{key-name}/backup'} # type: ignore + + async def restore_key( + self, + vault_base_url: str, + key_bundle_backup: bytes, + **kwargs + ) -> "models.KeyBundle": """Restores a backed up key to a vault. - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. + :param key_bundle_backup: The backup blob associated with a key bundle. :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_key.metadata['url'] + url = self.restore_key.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + restore_key.metadata = {'url': '/keys/restore'} # type: ignore + + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.encrypt.metadata['url'] + url = self.encrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} # type: ignore + + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Decrypts a single block of encrypted data. - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.decrypt.metadata['url'] + url = self.decrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} # type: ignore + + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Creates a signature from a digest using the specified key. - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeySignParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.sign.metadata['url'] + url = self.sign.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeySignParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, *, cls=None, **kwargs): + sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} # type: ignore + + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, + **kwargs + ) -> "models.KeyVerifyResult": """Verifies a signature using a specified key. - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param digest: The digest used for signing. :type digest: bytes :param signature: The signature to be verified. :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVerifyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.verify.metadata['url'] + url = self.verify.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyVerifyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) + deserialized = self._deserialize('KeyVerifyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} # type: ignore + + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Wraps a symmetric key using a specified key. - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.wrap_key.metadata['url'] + url = self.wrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} # type: ignore + + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.unwrap_key.metadata['url'] + url = self.unwrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} + unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} # type: ignore def get_deleted_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedKeyListResult"]: """Lists the deleted keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_keys.metadata['url'] + url = self.get_deleted_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedKeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedKeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + get_deleted_keys.metadata = {'url': '/deletedkeys'} # type: ignore + + async def get_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": """Gets the public part of a deleted key. - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_key.metadata['url'] + url = self.get_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore + + async def purge_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> None: """Permanently deletes the specified key. - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of the key + :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_key.metadata['url'] + url = self.purge_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore - async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + async def recover_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.KeyBundle": """Recovers the deleted key to its latest version. - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the deleted key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_key.metadata['url'] + url = self.recover_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - async def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, *, cls=None, **kwargs): + recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} # type: ignore + + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + value: str, + tags: Optional[Dict[str, str]] = None, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + **kwargs + ) -> "models.SecretBundle": """Sets a secret in a specified key vault. - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param value: The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type_parameter, secret_attributes=secret_attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_secret.metadata['url'] + url = self.set_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + set_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + async def delete_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": """Deletes a secret from a specified key vault. - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_secret.metadata['url'] + url = self.delete_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SecretBundle": + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretUpdateParameters(content_type=content_type_parameter, secret_attributes=secret_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_secret.metadata['url'] + url = self.update_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=None, **kwargs): + update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore + + async def get_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs + ) -> "models.SecretBundle": """Get a specified secret from a given key vault. - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_secret.metadata['url'] + url = self.get_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} + get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore def get_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SecretListResult"]: """List secrets in a specified key vault. - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secrets.metadata['url'] + url = self.get_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_secrets.metadata = {'url': '/secrets'} + get_secrets.metadata = {'url': '/secrets'} # type: ignore def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SecretListResult"]: """List all versions of the specified secret. - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secret_versions.metadata['url'] + url = self.get_secret_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} + get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} # type: ignore def get_deleted_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedSecretListResult"]: """Lists deleted secrets for the specified vault. - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_secrets.metadata['url'] + url = self.get_deleted_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedSecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + get_deleted_secrets.metadata = {'url': '/deletedsecrets'} # type: ignore + + async def get_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": """Gets the specified deleted secret. - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_secret.metadata['url'] + url = self.get_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + async def purge_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> None: """Permanently deletes the specified secret. - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_secret.metadata['url'] + url = self.purge_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} + return cls(pipeline_response, None, {}) - async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + async def recover_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.SecretBundle": """Recovers the deleted secret to the latest version. - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the deleted secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_secret.metadata['url'] + url = self.recover_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} # type: ignore + + async def backup_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.BackupSecretResult": """Backs up the specified secret. - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupSecretResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.backup_secret.metadata['url'] + url = self.backup_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) + deserialized = self._deserialize('BackupSecretResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None, **kwargs): + backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} # type: ignore + + async def restore_secret( + self, + vault_base_url: str, + secret_bundle_backup: bytes, + **kwargs + ) -> "models.SecretBundle": """Restores a backed up secret to a vault. - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. + :param secret_bundle_backup: The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_secret.metadata['url'] + url = self.restore_secret.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} + restore_secret.metadata = {'url': '/secrets/restore'} # type: ignore def get_certificates( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + async def delete_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + async def set_certificate_contacts( + self, + vault_base_url: str, + contact_list: Optional[List["models.Contact"]] = None, + **kwargs + ) -> "models.Contacts": """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def get_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def delete_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateIssuerListResult"]: """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: str, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. - :type credentials: - ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: Optional[str] = None, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. - :type credentials: - ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def get_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def delete_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateOperation": """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - async def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + async def get_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificatePolicy": """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, *, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: "models.CertificatePolicy", + **kwargs + ) -> "models.CertificatePolicy": """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + 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_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def get_certificate(self, vault_base_url, certificate_name, certificate_version, *, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def get_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs + ) -> "models.CertificateBundle": """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, *, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + cancellation_requested: bool, + **kwargs + ) -> "models.CertificateOperation": """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def get_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def get_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def delete_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def delete_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, *, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + x509_certificates: List[bytearray], + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedCertificateListResult"]: + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + async def get_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def purge_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> None: """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_certificate.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def recover_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateBundle": + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate + :param certificate_name: The name of the deleted certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_certificate.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore def get_storage_accounts( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.StorageListResult"]: + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_storage_accounts.metadata['url'] + url = self.get_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('StorageListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('StorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_storage_accounts.metadata = {'url': '/storage'} + get_storage_accounts.metadata = {'url': '/storage'} # type: ignore - async def delete_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. + async def delete_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": + """Deletes a storage account. This operation requires the storage/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_storage_account.metadata['url'] + url = self.delete_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def get_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. + delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def get_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": + """Gets information about a specified storage account. This operation requires the storage/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_storage_account.metadata['url'] + url = self.get_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + resource_id: str, + active_key_name: str, + auto_regenerate_key: bool, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str @@ -3942,534 +4160,564 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour :type resource_id: str :param active_key_name: Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_storage_account.metadata['url'] + url = self.set_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + active_key_name: Optional[str] = None, + auto_regenerate_key: Optional[bool] = None, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_storage_account.metadata['url'] + url = self.update_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, *, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + key_name: str, + **kwargs + ) -> "models.StorageBundle": + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param key_name: The storage account key name. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] + url = self.regenerate_storage_account_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} + regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} # type: ignore def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, *, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SasDefinitionListResult"]: + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_sas_definitions.metadata['url'] + url = self.get_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SasDefinitionListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} - - async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} # type: ignore + + async def delete_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_sas_definition.metadata['url'] + url = self.delete_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def get_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_sas_definition.metadata['url'] + url = self.get_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Dict[str, str], + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param parameters: Sas definition creation metadata in the form of - key-value pairs. + :param parameters: Sas definition creation metadata in the form of key-value pairs. :type parameters: dict[str, str] - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters1 = models.SasDefinitionCreateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionCreateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_sas_definition.metadata['url'] + url = self.set_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, parameters=None, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + parameters: Optional[Dict[str, str]] = None, + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param parameters: Sas definition update metadata in the form of - key-value pairs. + :param parameters: Sas definition update metadata in the form of key-value pairs. :type parameters: dict[str, str] - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters1 = models.SasDefinitionUpdateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionUpdateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_sas_definition.metadata['url'] + url = self.update_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/__init__.py index 6f134becdbd..5f3be613a75 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/__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. # -------------------------------------------------------------------------- try: @@ -59,7 +56,7 @@ from ._models_py3 import KeyRestoreParameters from ._models_py3 import KeySignParameters from ._models_py3 import KeyUpdateParameters - from ._models_py3 import KeyVaultError, KeyVaultErrorException + from ._models_py3 import KeyVaultError from ._models_py3 import KeyVerifyParameters from ._models_py3 import KeyVerifyResult from ._models_py3 import LifetimeAction @@ -90,94 +87,95 @@ from ._models_py3 import Trigger from ._models_py3 import X509CertificateProperties except (SyntaxError, ImportError): - from ._models import Action - from ._models import AdministratorDetails - from ._models import Attributes - from ._models import BackupKeyResult - from ._models import BackupSecretResult - from ._models import CertificateAttributes - from ._models import CertificateBundle - from ._models import CertificateCreateParameters - from ._models import CertificateImportParameters - from ._models import CertificateIssuerItem - from ._models import CertificateIssuerListResult - from ._models import CertificateIssuerSetParameters - from ._models import CertificateIssuerUpdateParameters - from ._models import CertificateItem - from ._models import CertificateListResult - from ._models import CertificateMergeParameters - from ._models import CertificateOperation - from ._models import CertificateOperationUpdateParameter - from ._models import CertificatePolicy - from ._models import CertificateUpdateParameters - from ._models import Contact - from ._models import Contacts - from ._models import DeletedCertificateBundle - from ._models import DeletedCertificateItem - from ._models import DeletedCertificateListResult - from ._models import DeletedKeyBundle - from ._models import DeletedKeyItem - from ._models import DeletedKeyListResult - from ._models import DeletedSecretBundle - from ._models import DeletedSecretItem - from ._models import DeletedSecretListResult - from ._models import Error - from ._models import IssuerAttributes - from ._models import IssuerBundle - from ._models import IssuerCredentials - from ._models import IssuerParameters - from ._models import JsonWebKey - from ._models import KeyAttributes - from ._models import KeyBundle - from ._models import KeyCreateParameters - from ._models import KeyImportParameters - from ._models import KeyItem - from ._models import KeyListResult - from ._models import KeyOperationResult - from ._models import KeyOperationsParameters - from ._models import KeyProperties - from ._models import KeyRestoreParameters - from ._models import KeySignParameters - from ._models import KeyUpdateParameters - from ._models import KeyVaultError, KeyVaultErrorException - from ._models import KeyVerifyParameters - from ._models import KeyVerifyResult - from ._models import LifetimeAction - from ._models import OrganizationDetails - from ._models import PendingCertificateSigningRequestResult - from ._models import SasDefinitionAttributes - from ._models import SasDefinitionBundle - from ._models import SasDefinitionCreateParameters - from ._models import SasDefinitionItem - from ._models import SasDefinitionListResult - from ._models import SasDefinitionUpdateParameters - from ._models import SecretAttributes - from ._models import SecretBundle - from ._models import SecretItem - from ._models import SecretListResult - from ._models import SecretProperties - from ._models import SecretRestoreParameters - from ._models import SecretSetParameters - from ._models import SecretUpdateParameters - from ._models import StorageAccountAttributes - from ._models import StorageAccountCreateParameters - from ._models import StorageAccountItem - from ._models import StorageAccountRegenerteKeyParameters - from ._models import StorageAccountUpdateParameters - from ._models import StorageBundle - from ._models import StorageListResult - from ._models import SubjectAlternativeNames - from ._models import Trigger - from ._models import X509CertificateProperties + from ._models import Action # type: ignore + from ._models import AdministratorDetails # type: ignore + from ._models import Attributes # type: ignore + from ._models import BackupKeyResult # type: ignore + from ._models import BackupSecretResult # type: ignore + from ._models import CertificateAttributes # type: ignore + from ._models import CertificateBundle # type: ignore + from ._models import CertificateCreateParameters # type: ignore + from ._models import CertificateImportParameters # type: ignore + from ._models import CertificateIssuerItem # type: ignore + from ._models import CertificateIssuerListResult # type: ignore + from ._models import CertificateIssuerSetParameters # type: ignore + from ._models import CertificateIssuerUpdateParameters # type: ignore + from ._models import CertificateItem # type: ignore + from ._models import CertificateListResult # type: ignore + from ._models import CertificateMergeParameters # type: ignore + from ._models import CertificateOperation # type: ignore + from ._models import CertificateOperationUpdateParameter # type: ignore + from ._models import CertificatePolicy # type: ignore + from ._models import CertificateUpdateParameters # type: ignore + from ._models import Contact # type: ignore + from ._models import Contacts # type: ignore + from ._models import DeletedCertificateBundle # type: ignore + from ._models import DeletedCertificateItem # type: ignore + from ._models import DeletedCertificateListResult # type: ignore + from ._models import DeletedKeyBundle # type: ignore + from ._models import DeletedKeyItem # type: ignore + from ._models import DeletedKeyListResult # type: ignore + from ._models import DeletedSecretBundle # type: ignore + from ._models import DeletedSecretItem # type: ignore + from ._models import DeletedSecretListResult # type: ignore + from ._models import Error # type: ignore + from ._models import IssuerAttributes # type: ignore + from ._models import IssuerBundle # type: ignore + from ._models import IssuerCredentials # type: ignore + from ._models import IssuerParameters # type: ignore + from ._models import JsonWebKey # type: ignore + from ._models import KeyAttributes # type: ignore + from ._models import KeyBundle # type: ignore + from ._models import KeyCreateParameters # type: ignore + from ._models import KeyImportParameters # type: ignore + from ._models import KeyItem # type: ignore + from ._models import KeyListResult # type: ignore + from ._models import KeyOperationResult # type: ignore + from ._models import KeyOperationsParameters # type: ignore + from ._models import KeyProperties # type: ignore + from ._models import KeyRestoreParameters # type: ignore + from ._models import KeySignParameters # type: ignore + from ._models import KeyUpdateParameters # type: ignore + from ._models import KeyVaultError # type: ignore + from ._models import KeyVerifyParameters # type: ignore + from ._models import KeyVerifyResult # type: ignore + from ._models import LifetimeAction # type: ignore + from ._models import OrganizationDetails # type: ignore + from ._models import PendingCertificateSigningRequestResult # type: ignore + from ._models import SasDefinitionAttributes # type: ignore + from ._models import SasDefinitionBundle # type: ignore + from ._models import SasDefinitionCreateParameters # type: ignore + from ._models import SasDefinitionItem # type: ignore + from ._models import SasDefinitionListResult # type: ignore + from ._models import SasDefinitionUpdateParameters # type: ignore + from ._models import SecretAttributes # type: ignore + from ._models import SecretBundle # type: ignore + from ._models import SecretItem # type: ignore + from ._models import SecretListResult # type: ignore + from ._models import SecretProperties # type: ignore + from ._models import SecretRestoreParameters # type: ignore + from ._models import SecretSetParameters # type: ignore + from ._models import SecretUpdateParameters # type: ignore + from ._models import StorageAccountAttributes # type: ignore + from ._models import StorageAccountCreateParameters # type: ignore + from ._models import StorageAccountItem # type: ignore + from ._models import StorageAccountRegenerteKeyParameters # type: ignore + from ._models import StorageAccountUpdateParameters # type: ignore + from ._models import StorageBundle # type: ignore + from ._models import StorageListResult # type: ignore + from ._models import SubjectAlternativeNames # type: ignore + from ._models import Trigger # type: ignore + from ._models import X509CertificateProperties # type: ignore + from ._key_vault_client_enums import ( - JsonWebKeyType, - JsonWebKeyCurveName, - DeletionRecoveryLevel, - KeyUsageType, ActionType, - JsonWebKeyOperation, + DeletionRecoveryLevel, + JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, + JsonWebKeyOperation, JsonWebKeySignatureAlgorithm, + JsonWebKeyType, + KeyUsageType, ) __all__ = [ @@ -230,7 +228,7 @@ 'KeyRestoreParameters', 'KeySignParameters', 'KeyUpdateParameters', - 'KeyVaultError', 'KeyVaultErrorException', + 'KeyVaultError', 'KeyVerifyParameters', 'KeyVerifyResult', 'LifetimeAction', @@ -260,12 +258,12 @@ 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'JsonWebKeyType', - 'JsonWebKeyCurveName', - 'DeletionRecoveryLevel', - 'KeyUsageType', 'ActionType', - 'JsonWebKeyOperation', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', 'JsonWebKeyEncryptionAlgorithm', + 'JsonWebKeyOperation', 'JsonWebKeySignatureAlgorithm', + 'JsonWebKeyType', + 'KeyUsageType', ] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_key_vault_client_enums.py index c9bb22cda15..11f05f952c3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_key_vault_client_enums.py @@ -1,62 +1,51 @@ # 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 ActionType(str, Enum): + """The type of the action. + """ -class JsonWebKeyType(str, Enum): - - ec = "EC" - ec_hsm = "EC-HSM" - rsa = "RSA" - rsa_hsm = "RSA-HSM" - oct = "oct" - - -class JsonWebKeyCurveName(str, Enum): - - p_256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. - p_384 = "P-384" #: The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. - p_521 = "P-521" #: The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. - secp256_k1 = "SECP256K1" #: The SECG SECP256K1 elliptic curve. - + email_contacts = "EmailContacts" + auto_renew = "AutoRenew" class DeletionRecoveryLevel(str, Enum): + """Reflects the deletion recovery level currently in effect for keys in the current vault. If it + contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only + the system can purge the key, at the end of the retention interval. + """ purgeable = "Purgeable" #: Soft-delete is not enabled for this vault. A DELETE operation results in immediate and irreversible data loss. recoverable_purgeable = "Recoverable+Purgeable" #: Soft-delete is enabled for this vault; A privileged user may trigger an immediate, irreversible deletion(purge) of a deleted entity. recoverable = "Recoverable" #: Soft-delete is enabled for this vault and purge has been disabled. A deleted entity will remain in this state until recovered, or the end of the retention interval. recoverable_protected_subscription = "Recoverable+ProtectedSubscription" #: Soft-delete is enabled for this vault, and the subscription is protected against immediate deletion. +class JsonWebKeyCurveName(str, Enum): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ -class KeyUsageType(str, Enum): - - digital_signature = "digitalSignature" - non_repudiation = "nonRepudiation" - key_encipherment = "keyEncipherment" - data_encipherment = "dataEncipherment" - key_agreement = "keyAgreement" - key_cert_sign = "keyCertSign" - c_rl_sign = "cRLSign" - encipher_only = "encipherOnly" - decipher_only = "decipherOnly" - - -class ActionType(str, Enum): + p256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. + p384 = "P-384" #: The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. + p521 = "P-521" #: The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. + secp256_k1 = "SECP256K1" #: The SECG SECP256K1 elliptic curve. - email_contacts = "EmailContacts" - auto_renew = "AutoRenew" +class JsonWebKeyEncryptionAlgorithm(str, Enum): + """algorithm identifier + """ + rsa_oaep = "RSA-OAEP" + rsa_oaep256 = "RSA-OAEP-256" + rsa1_5 = "RSA1_5" class JsonWebKeyOperation(str, Enum): + """JSON web key operations. For more information, see JsonWebKeyOperation. + """ encrypt = "encrypt" decrypt = "decrypt" @@ -65,15 +54,10 @@ class JsonWebKeyOperation(str, Enum): wrap_key = "wrapKey" unwrap_key = "unwrapKey" - -class JsonWebKeyEncryptionAlgorithm(str, Enum): - - rsa_oaep = "RSA-OAEP" - rsa_oaep_256 = "RSA-OAEP-256" - rsa1_5 = "RSA1_5" - - class JsonWebKeySignatureAlgorithm(str, Enum): + """The signing/verification algorithm identifier. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. + """ ps256 = "PS256" ps384 = "PS384" @@ -86,3 +70,25 @@ class JsonWebKeySignatureAlgorithm(str, Enum): es384 = "ES384" es512 = "ES512" ecdsa256 = "ECDSA256" + +class JsonWebKeyType(str, Enum): + """JsonWebKey key type (kty). + """ + + ec = "EC" + ec_hsm = "EC-HSM" + rsa = "RSA" + rsa_hsm = "RSA-HSM" + oct = "oct" + +class KeyUsageType(str, Enum): + + digital_signature = "digitalSignature" + non_repudiation = "nonRepudiation" + key_encipherment = "keyEncipherment" + data_encipherment = "dataEncipherment" + key_agreement = "keyAgreement" + key_cert_sign = "keyCertSign" + c_rl_sign = "cRLSign" + encipher_only = "encipherOnly" + decipher_only = "decipherOnly" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models.py index d20f0261340..71ec3328f9d 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models.py @@ -1,36 +1,36 @@ # 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 azure.core.exceptions import HttpResponseError +import msrest.serialization -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +50,10 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = kwargs.get('first_name', None) self.last_name = kwargs.get('last_name', None) @@ -58,22 +61,21 @@ def __init__(self, **kwargs): self.phone = kwargs.get('phone', None) -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +91,10 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -98,11 +103,10 @@ def __init__(self, **kwargs): self.updated = None -class BackupKeyResult(Model): +class BackupKeyResult(msrest.serialization.Model): """The backup key result, containing the backup blob. - 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 value: The backup blob containing the backed up key. :vartype value: bytes @@ -116,16 +120,18 @@ class BackupKeyResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupKeyResult, self).__init__(**kwargs) self.value = None -class BackupSecretResult(Model): +class BackupSecretResult(msrest.serialization.Model): """The backup secret result, containing the backup blob. - 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 value: The backup blob containing the backed up secret. :vartype value: bytes @@ -139,7 +145,10 @@ class BackupSecretResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupSecretResult, self).__init__(**kwargs) self.value = None @@ -147,28 +156,24 @@ def __init__(self, **kwargs): class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -186,16 +191,18 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateAttributes, self).__init__(**kwargs) self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -213,7 +220,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -237,7 +244,10 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -250,17 +260,14 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -270,33 +277,32 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -312,16 +318,19 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) - self.base64_encoded_certificate = kwargs.get('base64_encoded_certificate', None) + self.base64_encoded_certificate = kwargs['base64_encoded_certificate'] self.password = kwargs.get('password', None) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -335,23 +344,23 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.provider = kwargs.get('provider', None) -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. - :vartype value: - list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str """ @@ -366,13 +375,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -381,10 +393,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -400,25 +410,26 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) + self.provider = kwargs['provider'] self.credentials = kwargs.get('credentials', None) self.organization_details = kwargs.get('organization_details', None) self.attributes = kwargs.get('attributes', None) -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -430,7 +441,10 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.credentials = kwargs.get('credentials', None) @@ -438,14 +452,14 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -458,7 +472,10 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.attributes = kwargs.get('attributes', None) @@ -466,14 +483,13 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -489,25 +505,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -521,30 +537,30 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) - self.x509_certificates = kwargs.get('x509_certificates', None) + self.x509_certificates = kwargs['x509_certificates'] self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. - :type issuer_parameters: - ~azure.keyvault.v2016_10_01.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -552,8 +568,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v2016_10_01.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -575,7 +590,10 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = kwargs.get('issuer_parameters', None) @@ -588,13 +606,13 @@ def __init__(self, **kwargs): self.request_id = kwargs.get('request_id', None) -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -606,36 +624,32 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) - self.cancellation_requested = kwargs.get('cancellation_requested', None) + self.cancellation_requested = kwargs['cancellation_requested'] -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str :param key_properties: Properties of the key backing a certificate. :type key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. - :type secret_properties: - ~azure.keyvault.v2016_10_01.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :type secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v2016_10_01.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. - :type lifetime_actions: - list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. - :type issuer_parameters: - ~azure.keyvault.v2016_10_01.models.IssuerParameters + :type lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes """ @@ -654,7 +668,10 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = kwargs.get('key_properties', None) @@ -665,17 +682,14 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -685,14 +699,17 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -709,18 +726,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = kwargs.get('email_address', None) self.name = kwargs.get('name', None) self.phone = kwargs.get('phone', None) -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -737,18 +756,19 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = kwargs.get('contact_list', None) class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -766,16 +786,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -803,7 +822,10 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None @@ -811,28 +833,25 @@ def __init__(self, **kwargs): class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -850,23 +869,24 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates - :vartype value: - list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str """ @@ -881,26 +901,28 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): +class KeyBundle(msrest.serialization.Model): """A KeyBundle consisting of a WebKey plus its attributes. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -915,7 +937,10 @@ class KeyBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyBundle, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.attributes = kwargs.get('attributes', None) @@ -924,29 +949,26 @@ def __init__(self, **kwargs): class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. + """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -965,27 +987,29 @@ class DeletedKeyBundle(KeyBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(Model): +class KeyItem(msrest.serialization.Model): """The key item containing key metadata. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -1000,7 +1024,10 @@ class KeyItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyItem, self).__init__(**kwargs) self.kid = kwargs.get('kid', None) self.attributes = kwargs.get('attributes', None) @@ -1009,29 +1036,26 @@ def __init__(self, **kwargs): class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. + """The deleted key item containing the deleted key metadata and information about deletion. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1050,21 +1074,23 @@ class DeletedKeyItem(KeyItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(Model): +class DeletedKeyListResult(msrest.serialization.Model): """A list of keys that have been deleted in this 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 value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys + :ivar value: A response message containing a list of deleted keys in the vault along with a + link to the next page of deleted keys. :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :ivar next_link: The URL to get the next set of deleted keys. :vartype next_link: str @@ -1080,17 +1106,19 @@ class DeletedKeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(Model): +class SecretBundle(msrest.serialization.Model): """A secret consisting of a value, id and its attributes. - 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. :param value: The secret value. :type value: str @@ -1100,13 +1128,13 @@ class SecretBundle(Model): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool """ @@ -1125,7 +1153,10 @@ class SecretBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretBundle, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.id = kwargs.get('id', None) @@ -1137,11 +1168,9 @@ def __init__(self, **kwargs): class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. + """A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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. :param value: The secret value. :type value: str @@ -1151,22 +1180,21 @@ class DeletedSecretBundle(SecretBundle): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1189,29 +1217,31 @@ class DeletedSecretBundle(SecretBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class SecretItem(Model): +class SecretItem(msrest.serialization.Model): """The secret item containing secret metadata. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool """ @@ -1227,7 +1257,10 @@ class SecretItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.attributes = kwargs.get('attributes', None) @@ -1239,28 +1272,26 @@ def __init__(self, **kwargs): class DeletedSecretItem(SecretItem): """The deleted secret item containing metadata about the deleted secret. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1280,21 +1311,23 @@ class DeletedSecretItem(SecretItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedSecretListResult(Model): +class DeletedSecretListResult(msrest.serialization.Model): """The deleted secret list result. - 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 value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets + :ivar value: A response message containing a list of the deleted secrets in the vault along + with a link to the next page of deleted secrets. :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :ivar next_link: The URL to get the next set of deleted secrets. :vartype next_link: str @@ -1310,23 +1343,25 @@ class DeletedSecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class Error(Model): +class Error(msrest.serialization.Model): """The key vault server error. - 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 code: The error code. :vartype code: str :ivar message: The error message. :vartype message: str - :ivar inner_error: + :ivar inner_error: The key vault server error. :vartype inner_error: ~azure.keyvault.v2016_10_01.models.Error """ @@ -1342,25 +1377,27 @@ class Error(Model): 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(Model): +class IssuerAttributes(msrest.serialization.Model): """The attributes of an issuer managed by the Key Vault service. - 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. :param enabled: Determines whether the issuer is enabled. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -1374,18 +1411,20 @@ class IssuerAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None self.updated = None -class IssuerBundle(Model): +class IssuerBundle(msrest.serialization.Model): """The issuer for Key Vault certificate. - 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: Identifier for the issuer object. :vartype id: str @@ -1393,10 +1432,8 @@ class IssuerBundle(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -1413,7 +1450,10 @@ class IssuerBundle(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerBundle, self).__init__(**kwargs) self.id = None self.provider = kwargs.get('provider', None) @@ -1422,7 +1462,7 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class IssuerCredentials(Model): +class IssuerCredentials(msrest.serialization.Model): """The credentials to be used for the certificate issuer. :param account_id: The user name/account name/account id. @@ -1436,20 +1476,22 @@ class IssuerCredentials(Model): 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerCredentials, self).__init__(**kwargs) self.account_id = kwargs.get('account_id', None) self.password = kwargs.get('password', None) -class IssuerParameters(Model): +class IssuerParameters(msrest.serialization.Model): """Parameters for the issuer of the X509 component of a certificate. - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. :type name: str - :param certificate_type: Type of certificate to be requested from the - issuer provider. + :param certificate_type: Type of certificate to be requested from the issuer provider. :type certificate_type: str """ @@ -1458,19 +1500,22 @@ class IssuerParameters(Model): 'certificate_type': {'key': 'cty', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerParameters, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.certificate_type = kwargs.get('certificate_type', None) -class JsonWebKey(Model): +class JsonWebKey(msrest.serialization.Model): """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :param kid: Key identifier. :type kid: str - :param kty: JsonWebKey key type (kty). Possible values include: 'EC', - 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", "RSA- + HSM", "oct". :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :param key_ops: :type key_ops: list[str] @@ -1494,9 +1539,8 @@ class JsonWebKey(Model): :type k: bytes :param t: HSM Token, used with 'Bring Your Own Key'. :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'SECP256K1' + :param crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "SECP256K1". :type crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :param x: X component of an EC public key. :type x: bytes @@ -1523,7 +1567,10 @@ class JsonWebKey(Model): 'y': {'key': 'y', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JsonWebKey, self).__init__(**kwargs) self.kid = kwargs.get('kid', None) self.kty = kwargs.get('kty', None) @@ -1546,27 +1593,24 @@ def __init__(self, **kwargs): class KeyAttributes(Attributes): """The attributes of a key managed by the key vault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for keys in the + current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged + user; otherwise, only the system can purge the key, at the end of the retention interval. + Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -1584,38 +1628,37 @@ class KeyAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyAttributes, self).__init__(**kwargs) self.recovery_level = None -class KeyCreateParameters(Model): +class KeyCreateParameters(msrest.serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' + :param kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible + values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'SECP256K1' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "SECP256K1". :type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True, 'min_length': 1}, + 'kty': {'required': True}, } _attribute_map = { @@ -1627,9 +1670,12 @@ class KeyCreateParameters(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kwargs.get('kty', None) + self.kty = kwargs['kty'] self.key_size = kwargs.get('key_size', None) self.key_ops = kwargs.get('key_ops', None) self.key_attributes = kwargs.get('key_attributes', None) @@ -1637,18 +1683,18 @@ def __init__(self, **kwargs): self.curve = kwargs.get('curve', None) -class KeyImportParameters(Model): +class KeyImportParameters(msrest.serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool - :param key: Required. The Json web key + :param key: Required. The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -1663,22 +1709,24 @@ class KeyImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyImportParameters, self).__init__(**kwargs) self.hsm = kwargs.get('hsm', None) - self.key = kwargs.get('key', None) + self.key = kwargs['key'] self.key_attributes = kwargs.get('key_attributes', None) self.tags = kwargs.get('tags', None) -class KeyListResult(Model): +class KeyListResult(msrest.serialization.Model): """The key list result. - 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 value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. + :ivar value: A response message containing a list of keys in the key vault along with a link to + the next page of keys. :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] :ivar next_link: The URL to get the next set of keys. :vartype next_link: str @@ -1694,19 +1742,21 @@ class KeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(Model): +class KeyOperationResult(msrest.serialization.Model): """The key operation result. - 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 kid: Key identifier + :ivar kid: Key identifier. :vartype kid: str :ivar result: :vartype result: bytes @@ -1722,27 +1772,29 @@ class KeyOperationResult(Model): 'result': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyOperationResult, self).__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(Model): +class KeyOperationsParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", "RSA- + OAEP-256", "RSA1_5". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -1751,24 +1803,25 @@ class KeyOperationsParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) + self.algorithm = kwargs['algorithm'] + self.value = kwargs['value'] -class KeyProperties(Model): +class KeyProperties(msrest.serialization.Model): """Properties of the key pair backing a certificate. :param exportable: Indicates if the private key can be exported. :type exportable: bool :param key_type: The key type. :type key_type: str - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. :type reuse_key: bool """ @@ -1779,7 +1832,10 @@ class KeyProperties(Model): 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyProperties, self).__init__(**kwargs) self.exportable = kwargs.get('exportable', None) self.key_type = kwargs.get('key_type', None) @@ -1787,13 +1843,12 @@ def __init__(self, **kwargs): self.reuse_key = kwargs.get('reuse_key', None) -class KeyRestoreParameters(Model): +class KeyRestoreParameters(msrest.serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. + :param key_bundle_backup: Required. The backup blob associated with a key bundle. :type key_bundle_backup: bytes """ @@ -1805,29 +1860,30 @@ class KeyRestoreParameters(Model): 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs.get('key_bundle_backup', None) + self.key_bundle_backup = kwargs['key_bundle_backup'] -class KeySignParameters(Model): +class KeySignParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm identifier. For more information + on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", + "ECDSA256". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -1836,22 +1892,24 @@ class KeySignParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) + self.algorithm = kwargs['algorithm'] + self.value = kwargs['value'] -class KeyUpdateParameters(Model): +class KeyUpdateParameters(msrest.serialization.Model): """The key update parameters. - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -1861,20 +1919,22 @@ class KeyUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyUpdateParameters, self).__init__(**kwargs) self.key_ops = kwargs.get('key_ops', None) self.key_attributes = kwargs.get('key_attributes', None) self.tags = kwargs.get('tags', None) -class KeyVaultError(Model): +class KeyVaultError(msrest.serialization.Model): """The key vault error exception. - 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 error: + :ivar error: The key vault server error. :vartype error: ~azure.keyvault.v2016_10_01.models.Error """ @@ -1886,38 +1946,23 @@ class KeyVaultError(Model): 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVaultError, self).__init__(**kwargs) self.error = None -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): +class KeyVerifyParameters(msrest.serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", "ECDSA256". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param digest: Required. The digest used for signing. :type digest: bytes :param signature: Required. The signature to be verified. @@ -1925,7 +1970,7 @@ class KeyVerifyParameters(Model): """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'digest': {'required': True}, 'signature': {'required': True}, } @@ -1936,18 +1981,20 @@ class KeyVerifyParameters(Model): 'signature': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.digest = kwargs.get('digest', None) - self.signature = kwargs.get('signature', None) + self.algorithm = kwargs['algorithm'] + self.digest = kwargs['digest'] + self.signature = kwargs['signature'] -class KeyVerifyResult(Model): +class KeyVerifyResult(msrest.serialization.Model): """The key verify result. - 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 value: True if the signature is verified, otherwise false. :vartype value: bool @@ -1961,14 +2008,16 @@ class KeyVerifyResult(Model): 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVerifyResult, self).__init__(**kwargs) self.value = None -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :param trigger: The condition that will execute the action. :type trigger: ~azure.keyvault.v2016_10_01.models.Trigger @@ -1981,20 +2030,22 @@ class LifetimeAction(Model): 'action': {'key': 'action', 'type': 'Action'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LifetimeAction, self).__init__(**kwargs) self.trigger = kwargs.get('trigger', None) self.action = kwargs.get('action', None) -class OrganizationDetails(Model): +class OrganizationDetails(msrest.serialization.Model): """Details of the organization of the certificate issuer. :param id: Id of the organization. :type id: str :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] + :type admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] """ _attribute_map = { @@ -2002,20 +2053,21 @@ class OrganizationDetails(Model): 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OrganizationDetails, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.admin_details = kwargs.get('admin_details', None) -class PendingCertificateSigningRequestResult(Model): +class PendingCertificateSigningRequestResult(msrest.serialization.Model): """The pending certificate signing request result. - 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 value: The pending certificate signing request as Base64 encoded - string. + :ivar value: The pending certificate signing request as Base64 encoded string. :vartype value: str """ @@ -2027,23 +2079,25 @@ class PendingCertificateSigningRequestResult(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None -class SasDefinitionAttributes(Model): +class SasDefinitionAttributes(msrest.serialization.Model): """The SAS definition management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -2057,31 +2111,30 @@ class SasDefinitionAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None self.updated = None -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. +class SasDefinitionBundle(msrest.serialization.Model): + """A SAS definition bundle consists of key vault SAS definition details plus its attributes. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar parameters: The SAS definition metadata in the form of key-value - pairs. + :ivar parameters: The SAS definition metadata in the form of key-value pairs. :vartype parameters: dict[str, str] :ivar attributes: The SAS definition attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :vartype attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2101,7 +2154,10 @@ class SasDefinitionBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionBundle, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -2110,18 +2166,16 @@ def __init__(self, **kwargs): self.tags = None -class SasDefinitionCreateParameters(Model): +class SasDefinitionCreateParameters(msrest.serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :param parameters: Required. Sas definition creation metadata in the form - of key-value pairs. + :param parameters: Required. Sas definition creation metadata in the form of key-value pairs. :type parameters: dict[str, str] :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2135,27 +2189,28 @@ class SasDefinitionCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.parameters = kwargs.get('parameters', None) + self.parameters = kwargs['parameters'] self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) self.tags = kwargs.get('tags', None) -class SasDefinitionItem(Model): +class SasDefinitionItem(msrest.serialization.Model): """The SAS definition item containing storage SAS definition metadata. - 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 storage SAS identifier. :vartype id: str :ivar secret_id: The storage account SAS definition secret id. :vartype secret_id: str :ivar attributes: The SAS definition management attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2173,7 +2228,10 @@ class SasDefinitionItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionItem, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -2181,14 +2239,13 @@ def __init__(self, **kwargs): self.tags = None -class SasDefinitionListResult(Model): +class SasDefinitionListResult(msrest.serialization.Model): """The storage account SAS definition list result. - 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 value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. + :ivar value: A response message containing a list of SAS definitions along with a link to the + next page of SAS definitions. :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :ivar next_link: The URL to get the next set of SAS definitions. :vartype next_link: str @@ -2204,22 +2261,23 @@ class SasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(Model): +class SasDefinitionUpdateParameters(msrest.serialization.Model): """The SAS definition update parameters. - :param parameters: Sas definition update metadata in the form of key-value - pairs. + :param parameters: Sas definition update metadata in the form of key-value pairs. :type parameters: dict[str, str] :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2229,7 +2287,10 @@ class SasDefinitionUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionUpdateParameters, self).__init__(**kwargs) self.parameters = kwargs.get('parameters', None) self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) @@ -2239,27 +2300,24 @@ def __init__(self, **kwargs): class SecretAttributes(Attributes): """The secret management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for secrets in + the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a + privileged user; otherwise, only the system can purge the secret, at the end of the retention + interval. Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -2277,19 +2335,21 @@ class SecretAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretAttributes, self).__init__(**kwargs) self.recovery_level = None -class SecretListResult(Model): +class SecretListResult(msrest.serialization.Model): """The secret list result. - 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 value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. + :ivar value: A response message containing a list of secrets in the key vault along with a link + to the next page of secrets. :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] :ivar next_link: The URL to get the next set of secrets. :vartype next_link: str @@ -2305,13 +2365,16 @@ class SecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2322,18 +2385,20 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) -class SecretRestoreParameters(Model): +class SecretRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. + :param secret_bundle_backup: Required. The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes """ @@ -2345,25 +2410,27 @@ class SecretRestoreParameters(Model): 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs.get('secret_bundle_backup', None) + self.secret_bundle_backup = kwargs['secret_bundle_backup'] -class SecretSetParameters(Model): +class SecretSetParameters(msrest.serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. :param value: Required. The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes """ _validation = { @@ -2377,23 +2444,25 @@ class SecretSetParameters(Model): 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretSetParameters, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.tags = kwargs.get('tags', None) self.content_type = kwargs.get('content_type', None) self.secret_attributes = kwargs.get('secret_attributes', None) -class SecretUpdateParameters(Model): +class SecretUpdateParameters(msrest.serialization.Model): """The secret update parameters. :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2403,25 +2472,27 @@ class SecretUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretUpdateParameters, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) self.secret_attributes = kwargs.get('secret_attributes', None) self.tags = kwargs.get('tags', None) -class StorageAccountAttributes(Model): +class StorageAccountAttributes(msrest.serialization.Model): """The storage account management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -2435,14 +2506,17 @@ class StorageAccountAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None self.updated = None -class StorageAccountCreateParameters(Model): +class StorageAccountCreateParameters(msrest.serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. @@ -2451,16 +2525,14 @@ class StorageAccountCreateParameters(Model): :type resource_id: str :param active_key_name: Required. Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. + :param auto_regenerate_key: Required. whether keyvault should manage the storage account for + the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2479,30 +2551,31 @@ class StorageAccountCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.active_key_name = kwargs.get('active_key_name', None) - self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) + self.resource_id = kwargs['resource_id'] + self.active_key_name = kwargs['active_key_name'] + self.auto_regenerate_key = kwargs['auto_regenerate_key'] self.regeneration_period = kwargs.get('regeneration_period', None) self.storage_account_attributes = kwargs.get('storage_account_attributes', None) self.tags = kwargs.get('tags', None) -class StorageAccountItem(Model): +class StorageAccountItem(msrest.serialization.Model): """The storage account item containing storage account metadata. - 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: Storage identifier. :vartype id: str :ivar resource_id: Storage account resource Id. :vartype resource_id: str :ivar attributes: The storage account management attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2520,7 +2593,10 @@ class StorageAccountItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountItem, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -2528,7 +2604,7 @@ def __init__(self, **kwargs): self.tags = None -class StorageAccountRegenerteKeyParameters(Model): +class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. @@ -2545,26 +2621,26 @@ class StorageAccountRegenerteKeyParameters(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) + self.key_name = kwargs['key_name'] -class StorageAccountUpdateParameters(Model): +class StorageAccountUpdateParameters(msrest.serialization.Model): """The storage account update parameters. :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2576,7 +2652,10 @@ class StorageAccountUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.active_key_name = kwargs.get('active_key_name', None) self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) @@ -2585,12 +2664,10 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. +class StorageBundle(msrest.serialization.Model): + """A Storage account bundle consists of key vault storage account details plus its attributes. - 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 storage account id. :vartype id: str @@ -2598,16 +2675,13 @@ class StorageBundle(Model): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :vartype attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2631,7 +2705,10 @@ class StorageBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageBundle, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -2642,16 +2719,14 @@ def __init__(self, **kwargs): self.tags = None -class StorageListResult(Model): +class StorageListResult(msrest.serialization.Model): """The storage accounts list result. - 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 value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. - :vartype value: - list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar value: A response message containing a list of storage accounts in the key vault along + with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :ivar next_link: The URL to get the next set of storage accounts. :vartype next_link: str """ @@ -2666,13 +2741,16 @@ class StorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -2689,23 +2767,25 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = kwargs.get('emails', None) self.dns_names = kwargs.get('dns_names', None) self.upns = kwargs.get('upns', None) -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -2718,28 +2798,27 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = kwargs.get('lifetime_percentage', None) self.days_before_expiry = kwargs.get('days_before_expiry', None) -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames :param key_usage: List of key usages. - :type key_usage: list[str or - ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :type key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -2755,7 +2834,10 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.ekus = kwargs.get('ekus', None) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models_py3.py index 397d2baa8b3..36e7f067c94 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/models/_models_py3.py @@ -1,36 +1,43 @@ # 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 datetime +from typing import Dict, List, Optional, Union + from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._key_vault_client_enums import * -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v2016_10_01.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, *, action_type=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "ActionType"]] = None, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +57,15 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, first_name: str=None, last_name: str=None, email_address: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = first_name self.last_name = last_name @@ -58,22 +73,21 @@ def __init__(self, *, first_name: str=None, last_name: str=None, email_address: self.phone = phone -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +103,14 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -98,11 +119,10 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.updated = None -class BackupKeyResult(Model): +class BackupKeyResult(msrest.serialization.Model): """The backup key result, containing the backup blob. - 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 value: The backup blob containing the backed up key. :vartype value: bytes @@ -116,16 +136,18 @@ class BackupKeyResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupKeyResult, self).__init__(**kwargs) self.value = None -class BackupSecretResult(Model): +class BackupSecretResult(msrest.serialization.Model): """The backup secret result, containing the backup blob. - 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 value: The backup blob containing the backed up secret. :vartype value: bytes @@ -139,7 +161,10 @@ class BackupSecretResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupSecretResult, self).__init__(**kwargs) self.value = None @@ -147,28 +172,24 @@ def __init__(self, **kwargs) -> None: class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -186,16 +207,22 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -213,7 +240,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -237,7 +264,15 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -250,17 +285,14 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No self.tags = tags -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -270,33 +302,36 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -312,7 +347,16 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, base64_encoded_certificate: str, password: str=None, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password @@ -321,7 +365,7 @@ def __init__(self, *, base64_encoded_certificate: str, password: str=None, certi self.tags = tags -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -335,23 +379,26 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + provider: Optional[str] = None, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. - :vartype value: - list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str """ @@ -366,13 +413,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -381,10 +431,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -400,7 +448,15 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: str, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -408,17 +464,15 @@ def __init__(self, *, provider: str, credentials=None, organization_details=None self.attributes = attributes -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -430,7 +484,15 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -438,14 +500,14 @@ def __init__(self, *, provider: str=None, credentials=None, organization_details self.attributes = attributes -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -458,7 +520,15 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = id self.attributes = attributes @@ -466,14 +536,13 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -489,25 +558,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -521,30 +590,34 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, x509_certificates, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + x509_certificates: List[bytearray], + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. - :type issuer_parameters: - ~azure.keyvault.v2016_10_01.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -552,8 +625,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v2016_10_01.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -575,7 +647,19 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_requested: bool=None, status: str=None, status_details: str=None, error=None, target: str=None, request_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + issuer_parameters: Optional["IssuerParameters"] = None, + csr: Optional[bytearray] = None, + cancellation_requested: Optional[bool] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + error: Optional["Error"] = None, + target: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters @@ -588,13 +672,13 @@ def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_ self.request_id = request_id -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -606,36 +690,34 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, *, cancellation_requested: bool, **kwargs) -> None: + def __init__( + self, + *, + cancellation_requested: bool, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str :param key_properties: Properties of the key backing a certificate. :type key_properties: ~azure.keyvault.v2016_10_01.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. - :type secret_properties: - ~azure.keyvault.v2016_10_01.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :type secret_properties: ~azure.keyvault.v2016_10_01.models.SecretProperties + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v2016_10_01.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v2016_10_01.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. - :type lifetime_actions: - list[~azure.keyvault.v2016_10_01.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. - :type issuer_parameters: - ~azure.keyvault.v2016_10_01.models.IssuerParameters + :type lifetime_actions: list[~azure.keyvault.v2016_10_01.models.LifetimeAction] + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v2016_10_01.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes """ @@ -654,7 +736,17 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, *, key_properties=None, secret_properties=None, x509_certificate_properties=None, lifetime_actions=None, issuer_parameters=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + key_properties: Optional["KeyProperties"] = None, + secret_properties: Optional["SecretProperties"] = None, + x509_certificate_properties: Optional["X509CertificateProperties"] = None, + lifetime_actions: Optional[List["LifetimeAction"]] = None, + issuer_parameters: Optional["IssuerParameters"] = None, + attributes: Optional["CertificateAttributes"] = None, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = key_properties @@ -665,17 +757,14 @@ def __init__(self, *, key_properties=None, secret_properties=None, x509_certific self.attributes = attributes -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -685,14 +774,21 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -709,18 +805,24 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email_address: str=None, name: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + email_address: Optional[str] = None, + name: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -737,18 +839,21 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, *, contact_list=None, **kwargs) -> None: + def __init__( + self, + *, + contact_list: Optional[List["Contact"]] = None, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = contact_list class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -766,16 +871,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -803,7 +907,16 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None @@ -811,28 +924,25 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -850,23 +960,30 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates - :vartype value: - list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str """ @@ -881,26 +998,28 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): +class KeyBundle(msrest.serialization.Model): """A KeyBundle consisting of a WebKey plus its attributes. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -915,7 +1034,14 @@ class KeyBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, key=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional["JsonWebKey"] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyBundle, self).__init__(**kwargs) self.key = key self.attributes = attributes @@ -924,29 +1050,26 @@ def __init__(self, *, key=None, attributes=None, tags=None, **kwargs) -> None: class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. + """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -965,27 +1088,34 @@ class DeletedKeyBundle(KeyBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, key=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional["JsonWebKey"] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(Model): +class KeyItem(msrest.serialization.Model): """The key item containing key metadata. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -1000,7 +1130,14 @@ class KeyItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyItem, self).__init__(**kwargs) self.kid = kid self.attributes = attributes @@ -1009,29 +1146,26 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, **kwargs) -> No class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. + """The deleted key item containing the deleted key metadata and information about deletion. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1050,21 +1184,28 @@ class DeletedKeyItem(KeyItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(Model): +class DeletedKeyListResult(msrest.serialization.Model): """A list of keys that have been deleted in this 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 value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys + :ivar value: A response message containing a list of deleted keys in the vault along with a + link to the next page of deleted keys. :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :ivar next_link: The URL to get the next set of deleted keys. :vartype next_link: str @@ -1080,17 +1221,19 @@ class DeletedKeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedKeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(Model): +class SecretBundle(msrest.serialization.Model): """A secret consisting of a value, id and its attributes. - 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. :param value: The secret value. :type value: str @@ -1100,13 +1243,13 @@ class SecretBundle(Model): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool """ @@ -1125,7 +1268,16 @@ class SecretBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + id: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SecretBundle, self).__init__(**kwargs) self.value = value self.id = id @@ -1137,11 +1289,9 @@ def __init__(self, *, value: str=None, id: str=None, content_type: str=None, att class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. + """A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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. :param value: The secret value. :type value: str @@ -1151,22 +1301,21 @@ class DeletedSecretBundle(SecretBundle): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1189,29 +1338,38 @@ class DeletedSecretBundle(SecretBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + id: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SecretItem(Model): +class SecretItem(msrest.serialization.Model): """The secret item containing secret metadata. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool """ @@ -1227,7 +1385,15 @@ class SecretItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + **kwargs + ): super(SecretItem, self).__init__(**kwargs) self.id = id self.attributes = attributes @@ -1239,28 +1405,26 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st class DeletedSecretItem(SecretItem): """The deleted secret item containing metadata about the deleted secret. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1280,21 +1444,29 @@ class DeletedSecretItem(SecretItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSecretListResult(Model): +class DeletedSecretListResult(msrest.serialization.Model): """The deleted secret list result. - 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 value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets + :ivar value: A response message containing a list of the deleted secrets in the vault along + with a link to the next page of deleted secrets. :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :ivar next_link: The URL to get the next set of deleted secrets. :vartype next_link: str @@ -1310,23 +1482,25 @@ class DeletedSecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedSecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class Error(Model): +class Error(msrest.serialization.Model): """The key vault server error. - 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 code: The error code. :vartype code: str :ivar message: The error message. :vartype message: str - :ivar inner_error: + :ivar inner_error: The key vault server error. :vartype inner_error: ~azure.keyvault.v2016_10_01.models.Error """ @@ -1342,25 +1516,27 @@ class Error(Model): 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(Model): +class IssuerAttributes(msrest.serialization.Model): """The attributes of an issuer managed by the Key Vault service. - 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. :param enabled: Determines whether the issuer is enabled. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -1374,18 +1550,22 @@ class IssuerAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(IssuerAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(Model): +class IssuerBundle(msrest.serialization.Model): """The issuer for Key Vault certificate. - 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: Identifier for the issuer object. :vartype id: str @@ -1393,10 +1573,8 @@ class IssuerBundle(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes """ @@ -1413,7 +1591,15 @@ class IssuerBundle(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(IssuerBundle, self).__init__(**kwargs) self.id = None self.provider = provider @@ -1422,7 +1608,7 @@ def __init__(self, *, provider: str=None, credentials=None, organization_details self.attributes = attributes -class IssuerCredentials(Model): +class IssuerCredentials(msrest.serialization.Model): """The credentials to be used for the certificate issuer. :param account_id: The user name/account name/account id. @@ -1436,20 +1622,25 @@ class IssuerCredentials(Model): 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, *, account_id: str=None, password: str=None, **kwargs) -> None: + def __init__( + self, + *, + account_id: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): super(IssuerCredentials, self).__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(Model): +class IssuerParameters(msrest.serialization.Model): """Parameters for the issuer of the X509 component of a certificate. - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. :type name: str - :param certificate_type: Type of certificate to be requested from the - issuer provider. + :param certificate_type: Type of certificate to be requested from the issuer provider. :type certificate_type: str """ @@ -1458,19 +1649,25 @@ class IssuerParameters(Model): 'certificate_type': {'key': 'cty', 'type': 'str'}, } - def __init__(self, *, name: str=None, certificate_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + certificate_type: Optional[str] = None, + **kwargs + ): super(IssuerParameters, self).__init__(**kwargs) self.name = name self.certificate_type = certificate_type -class JsonWebKey(Model): +class JsonWebKey(msrest.serialization.Model): """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :param kid: Key identifier. :type kid: str - :param kty: JsonWebKey key type (kty). Possible values include: 'EC', - 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param kty: JsonWebKey key type (kty). Possible values include: "EC", "EC-HSM", "RSA", "RSA- + HSM", "oct". :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType :param key_ops: :type key_ops: list[str] @@ -1494,9 +1691,8 @@ class JsonWebKey(Model): :type k: bytes :param t: HSM Token, used with 'Bring Your Own Key'. :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'SECP256K1' + :param crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "SECP256K1". :type crv: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName :param x: X component of an EC public key. :type x: bytes @@ -1523,7 +1719,27 @@ class JsonWebKey(Model): 'y': {'key': 'y', 'type': 'base64'}, } - def __init__(self, *, kid: str=None, kty=None, key_ops=None, n: bytes=None, e: bytes=None, d: bytes=None, dp: bytes=None, dq: bytes=None, qi: bytes=None, p: bytes=None, q: bytes=None, k: bytes=None, t: bytes=None, crv=None, x: bytes=None, y: bytes=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[str]] = None, + n: Optional[bytes] = None, + e: Optional[bytes] = None, + d: Optional[bytes] = None, + dp: Optional[bytes] = None, + dq: Optional[bytes] = None, + qi: Optional[bytes] = None, + p: Optional[bytes] = None, + q: Optional[bytes] = None, + k: Optional[bytes] = None, + t: Optional[bytes] = None, + crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + x: Optional[bytes] = None, + y: Optional[bytes] = None, + **kwargs + ): super(JsonWebKey, self).__init__(**kwargs) self.kid = kid self.kty = kty @@ -1546,27 +1762,24 @@ def __init__(self, *, kid: str=None, kty=None, key_ops=None, n: bytes=None, e: b class KeyAttributes(Attributes): """The attributes of a key managed by the key vault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for keys in the + current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged + user; otherwise, only the system can purge the key, at the end of the retention interval. + Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -1584,38 +1797,41 @@ class KeyAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(Model): +class KeyCreateParameters(msrest.serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' + :param kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible + values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'SECP256K1' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "SECP256K1". :type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True, 'min_length': 1}, + 'kty': {'required': True}, } _attribute_map = { @@ -1627,7 +1843,17 @@ class KeyCreateParameters(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, *, kty, key_size: int=None, key_ops=None, key_attributes=None, tags=None, curve=None, **kwargs) -> None: + def __init__( + self, + *, + kty: Union[str, "JsonWebKeyType"], + key_size: Optional[int] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): super(KeyCreateParameters, self).__init__(**kwargs) self.kty = kty self.key_size = key_size @@ -1637,18 +1863,18 @@ def __init__(self, *, kty, key_size: int=None, key_ops=None, key_attributes=None self.curve = curve -class KeyImportParameters(Model): +class KeyImportParameters(msrest.serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool - :param key: Required. The Json web key + :param key: Required. The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -1663,7 +1889,15 @@ class KeyImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key: "JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyImportParameters, self).__init__(**kwargs) self.hsm = hsm self.key = key @@ -1671,14 +1905,13 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags -class KeyListResult(Model): +class KeyListResult(msrest.serialization.Model): """The key list result. - 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 value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. + :ivar value: A response message containing a list of keys in the key vault along with a link to + the next page of keys. :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] :ivar next_link: The URL to get the next set of keys. :vartype next_link: str @@ -1694,19 +1927,21 @@ class KeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(Model): +class KeyOperationResult(msrest.serialization.Model): """The key operation result. - 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 kid: Key identifier + :ivar kid: Key identifier. :vartype kid: str :ivar result: :vartype result: bytes @@ -1722,27 +1957,29 @@ class KeyOperationResult(Model): 'result': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyOperationResult, self).__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(Model): +class KeyOperationsParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", "RSA- + OAEP-256", "RSA1_5". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -1751,24 +1988,28 @@ class KeyOperationsParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ): super(KeyOperationsParameters, self).__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(Model): +class KeyProperties(msrest.serialization.Model): """Properties of the key pair backing a certificate. :param exportable: Indicates if the private key can be exported. :type exportable: bool :param key_type: The key type. :type key_type: str - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. :type reuse_key: bool """ @@ -1779,7 +2020,15 @@ class KeyProperties(Model): 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, } - def __init__(self, *, exportable: bool=None, key_type: str=None, key_size: int=None, reuse_key: bool=None, **kwargs) -> None: + def __init__( + self, + *, + exportable: Optional[bool] = None, + key_type: Optional[str] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + **kwargs + ): super(KeyProperties, self).__init__(**kwargs) self.exportable = exportable self.key_type = key_type @@ -1787,13 +2036,12 @@ def __init__(self, *, exportable: bool=None, key_type: str=None, key_size: int=N self.reuse_key = reuse_key -class KeyRestoreParameters(Model): +class KeyRestoreParameters(msrest.serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. + :param key_bundle_backup: Required. The backup blob associated with a key bundle. :type key_bundle_backup: bytes """ @@ -1805,29 +2053,32 @@ class KeyRestoreParameters(Model): 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, key_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + key_bundle_backup: bytes, + **kwargs + ): super(KeyRestoreParameters, self).__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(Model): +class KeySignParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm identifier. For more information + on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", + "ECDSA256". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -1836,22 +2087,27 @@ class KeySignParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + value: bytes, + **kwargs + ): super(KeySignParameters, self).__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(Model): +class KeyUpdateParameters(msrest.serialization.Model): """The key update parameters. - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -1861,20 +2117,26 @@ class KeyUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, key_ops=None, key_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyUpdateParameters, self).__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(Model): +class KeyVaultError(msrest.serialization.Model): """The key vault error exception. - 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 error: + :ivar error: The key vault server error. :vartype error: ~azure.keyvault.v2016_10_01.models.Error """ @@ -1886,38 +2148,23 @@ class KeyVaultError(Model): 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyVaultError, self).__init__(**kwargs) self.error = None -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): +class KeyVerifyParameters(msrest.serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", "ECDSA256". + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param digest: Required. The digest used for signing. :type digest: bytes :param signature: Required. The signature to be verified. @@ -1925,7 +2172,7 @@ class KeyVerifyParameters(Model): """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'digest': {'required': True}, 'signature': {'required': True}, } @@ -1936,18 +2183,24 @@ class KeyVerifyParameters(Model): 'signature': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, digest: bytes, signature: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, + **kwargs + ): super(KeyVerifyParameters, self).__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(Model): +class KeyVerifyResult(msrest.serialization.Model): """The key verify result. - 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 value: True if the signature is verified, otherwise false. :vartype value: bool @@ -1961,14 +2214,16 @@ class KeyVerifyResult(Model): 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyVerifyResult, self).__init__(**kwargs) self.value = None -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :param trigger: The condition that will execute the action. :type trigger: ~azure.keyvault.v2016_10_01.models.Trigger @@ -1981,20 +2236,25 @@ class LifetimeAction(Model): 'action': {'key': 'action', 'type': 'Action'}, } - def __init__(self, *, trigger=None, action=None, **kwargs) -> None: + def __init__( + self, + *, + trigger: Optional["Trigger"] = None, + action: Optional["Action"] = None, + **kwargs + ): super(LifetimeAction, self).__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(Model): +class OrganizationDetails(msrest.serialization.Model): """Details of the organization of the certificate issuer. :param id: Id of the organization. :type id: str :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] + :type admin_details: list[~azure.keyvault.v2016_10_01.models.AdministratorDetails] """ _attribute_map = { @@ -2002,20 +2262,24 @@ class OrganizationDetails(Model): 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, *, id: str=None, admin_details=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + admin_details: Optional[List["AdministratorDetails"]] = None, + **kwargs + ): super(OrganizationDetails, self).__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(Model): +class PendingCertificateSigningRequestResult(msrest.serialization.Model): """The pending certificate signing request result. - 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 value: The pending certificate signing request as Base64 encoded - string. + :ivar value: The pending certificate signing request as Base64 encoded string. :vartype value: str """ @@ -2027,23 +2291,25 @@ class PendingCertificateSigningRequestResult(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None -class SasDefinitionAttributes(Model): +class SasDefinitionAttributes(msrest.serialization.Model): """The SAS definition management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -2057,31 +2323,32 @@ class SasDefinitionAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(SasDefinitionAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. +class SasDefinitionBundle(msrest.serialization.Model): + """A SAS definition bundle consists of key vault SAS definition details plus its attributes. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar parameters: The SAS definition metadata in the form of key-value - pairs. + :ivar parameters: The SAS definition metadata in the form of key-value pairs. :vartype parameters: dict[str, str] :ivar attributes: The SAS definition attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :vartype attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2101,7 +2368,10 @@ class SasDefinitionBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionBundle, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -2110,18 +2380,16 @@ def __init__(self, **kwargs) -> None: self.tags = None -class SasDefinitionCreateParameters(Model): +class SasDefinitionCreateParameters(msrest.serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :param parameters: Required. Sas definition creation metadata in the form - of key-value pairs. + :param parameters: Required. Sas definition creation metadata in the form of key-value pairs. :type parameters: dict[str, str] :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2135,27 +2403,32 @@ class SasDefinitionCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, parameters, sas_definition_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + parameters: Dict[str, str], + sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SasDefinitionCreateParameters, self).__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes self.tags = tags -class SasDefinitionItem(Model): +class SasDefinitionItem(msrest.serialization.Model): """The SAS definition item containing storage SAS definition metadata. - 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 storage SAS identifier. :vartype id: str :ivar secret_id: The storage account SAS definition secret id. :vartype secret_id: str :ivar attributes: The SAS definition management attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2173,7 +2446,10 @@ class SasDefinitionItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionItem, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -2181,14 +2457,13 @@ def __init__(self, **kwargs) -> None: self.tags = None -class SasDefinitionListResult(Model): +class SasDefinitionListResult(msrest.serialization.Model): """The storage account SAS definition list result. - 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 value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. + :ivar value: A response message containing a list of SAS definitions along with a link to the + next page of SAS definitions. :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :ivar next_link: The URL to get the next set of SAS definitions. :vartype next_link: str @@ -2204,22 +2479,23 @@ class SasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(Model): +class SasDefinitionUpdateParameters(msrest.serialization.Model): """The SAS definition update parameters. - :param parameters: Sas definition update metadata in the form of key-value - pairs. + :param parameters: Sas definition update metadata in the form of key-value pairs. :type parameters: dict[str, str] :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2229,7 +2505,14 @@ class SasDefinitionUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, parameters=None, sas_definition_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + parameters: Optional[Dict[str, str]] = None, + sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SasDefinitionUpdateParameters, self).__init__(**kwargs) self.parameters = parameters self.sas_definition_attributes = sas_definition_attributes @@ -2239,27 +2522,24 @@ def __init__(self, *, parameters=None, sas_definition_attributes=None, tags=None class SecretAttributes(Attributes): """The secret management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for secrets in + the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a + privileged user; otherwise, only the system can purge the secret, at the end of the retention + interval. Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v2016_10_01.models.DeletionRecoveryLevel """ _validation = { @@ -2277,19 +2557,25 @@ class SecretAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(Model): +class SecretListResult(msrest.serialization.Model): """The secret list result. - 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 value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. + :ivar value: A response message containing a list of secrets in the key vault along with a link + to the next page of secrets. :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] :ivar next_link: The URL to get the next set of secrets. :vartype next_link: str @@ -2305,13 +2591,16 @@ class SecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2322,18 +2611,22 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, *, content_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + content_type: Optional[str] = None, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(Model): +class SecretRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. + :param secret_bundle_backup: Required. The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes """ @@ -2345,25 +2638,29 @@ class SecretRestoreParameters(Model): 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, secret_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + secret_bundle_backup: bytes, + **kwargs + ): super(SecretRestoreParameters, self).__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(Model): +class SecretSetParameters(msrest.serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. :param value: Required. The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes """ _validation = { @@ -2377,7 +2674,15 @@ class SecretSetParameters(Model): 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, } - def __init__(self, *, value: str, tags=None, content_type: str=None, secret_attributes=None, **kwargs) -> None: + def __init__( + self, + *, + value: str, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + secret_attributes: Optional["SecretAttributes"] = None, + **kwargs + ): super(SecretSetParameters, self).__init__(**kwargs) self.value = value self.tags = tags @@ -2385,15 +2690,14 @@ def __init__(self, *, value: str, tags=None, content_type: str=None, secret_attr self.secret_attributes = secret_attributes -class SecretUpdateParameters(Model): +class SecretUpdateParameters(msrest.serialization.Model): """The secret update parameters. :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2403,25 +2707,31 @@ class SecretUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, content_type: str=None, secret_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + content_type: Optional[str] = None, + secret_attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SecretUpdateParameters, self).__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(Model): +class StorageAccountAttributes(msrest.serialization.Model): """The storage account management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -2435,14 +2745,19 @@ class StorageAccountAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(StorageAccountAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class StorageAccountCreateParameters(Model): +class StorageAccountCreateParameters(msrest.serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. @@ -2451,16 +2766,14 @@ class StorageAccountCreateParameters(Model): :type resource_id: str :param active_key_name: Required. Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. + :param auto_regenerate_key: Required. whether keyvault should manage the storage account for + the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2479,7 +2792,17 @@ class StorageAccountCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, resource_id: str, active_key_name: str, auto_regenerate_key: bool, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: str, + active_key_name: str, + auto_regenerate_key: bool, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(StorageAccountCreateParameters, self).__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name @@ -2489,20 +2812,18 @@ def __init__(self, *, resource_id: str, active_key_name: str, auto_regenerate_ke self.tags = tags -class StorageAccountItem(Model): +class StorageAccountItem(msrest.serialization.Model): """The storage account item containing storage account metadata. - 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: Storage identifier. :vartype id: str :ivar resource_id: Storage account resource Id. :vartype resource_id: str :ivar attributes: The storage account management attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :vartype attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2520,7 +2841,10 @@ class StorageAccountItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageAccountItem, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -2528,7 +2852,7 @@ def __init__(self, **kwargs) -> None: self.tags = None -class StorageAccountRegenerteKeyParameters(Model): +class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. @@ -2545,26 +2869,28 @@ class StorageAccountRegenerteKeyParameters(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, key_name: str, **kwargs) -> None: + def __init__( + self, + *, + key_name: str, + **kwargs + ): super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(Model): +class StorageAccountUpdateParameters(msrest.serialization.Model): """The storage account update parameters. :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2576,7 +2902,16 @@ class StorageAccountUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + active_key_name: Optional[str] = None, + auto_regenerate_key: Optional[bool] = None, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -2585,12 +2920,10 @@ def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, self.tags = tags -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. +class StorageBundle(msrest.serialization.Model): + """A Storage account bundle consists of key vault storage account details plus its attributes. - 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 storage account id. :vartype id: str @@ -2598,16 +2931,13 @@ class StorageBundle(Model): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. - :vartype attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :vartype attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -2631,7 +2961,10 @@ class StorageBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageBundle, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -2642,16 +2975,14 @@ def __init__(self, **kwargs) -> None: self.tags = None -class StorageListResult(Model): +class StorageListResult(msrest.serialization.Model): """The storage accounts list result. - 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 value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. - :vartype value: - list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar value: A response message containing a list of storage accounts in the key vault along + with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :ivar next_link: The URL to get the next set of storage accounts. :vartype next_link: str """ @@ -2666,13 +2997,16 @@ class StorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -2689,23 +3023,29 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, *, emails=None, dns_names=None, upns=None, **kwargs) -> None: + def __init__( + self, + *, + emails: Optional[List[str]] = None, + dns_names: Optional[List[str]] = None, + upns: Optional[List[str]] = None, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -2718,28 +3058,30 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, *, lifetime_percentage: int=None, days_before_expiry: int=None, **kwargs) -> None: + def __init__( + self, + *, + lifetime_percentage: Optional[int] = None, + days_before_expiry: Optional[int] = None, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v2016_10_01.models.SubjectAlternativeNames :param key_usage: List of key usages. - :type key_usage: list[str or - ~azure.keyvault.v2016_10_01.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :type key_usage: list[str or ~azure.keyvault.v2016_10_01.models.KeyUsageType] + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -2755,7 +3097,16 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, *, subject: str=None, ekus=None, subject_alternative_names=None, key_usage=None, validity_in_months: int=None, **kwargs) -> None: + def __init__( + self, + *, + subject: Optional[str] = None, + ekus: Optional[List[str]] = None, + subject_alternative_names: Optional["SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + validity_in_months: Optional[int] = None, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = subject self.ekus = ekus diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/__init__.py index 603e37d3ee0..44bfc9d07bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/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 ._key_vault_client_operations import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_key_vault_client_operations.py index a84f1ad1ee7..fecfe0c740a 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/operations/_key_vault_client_operations.py @@ -1,3940 +1,4222 @@ # 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 TYPE_CHECKING +import warnings -from azure.core.exceptions import map_error +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged -from .. import models -import uuid +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from .. import models -class KeyVaultClientOperationsMixin(object): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. +class KeyVaultClientOperationsMixin(object): - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + def create_key( + self, + vault_base_url, # type: str + key_name, # type: str + kty, # type: Union[str, "models.JsonWebKeyType"] + key_size=None, # type: Optional[int] + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + curve=None, # type: Optional[Union[str, "models.JsonWebKeyCurveName"]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. + :param key_name: The name for the new key. The system will generate the version name for the + new key. :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' + :param kty: The type of key to create. For valid values, see JsonWebKeyType. :type kty: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'SECP256K1' - :type curve: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. + :type curve: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyCurveName + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_key.metadata['url'] + url = self.create_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + create_key.metadata = {'url': '/keys/{key-name}/create'} # type: ignore + + def import_key( + self, + vault_base_url, # type: str + key_name, # type: str + key, # type: "models.JsonWebKey" + hsm=None, # type: Optional[bool] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: Name for the imported key. :type key_name: str - :param key: The Json web key + :param key: The Json web key. :type key: ~azure.keyvault.v2016_10_01.models.JsonWebKey :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_key.metadata['url'] + url = self.import_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): + import_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + def delete_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedKeyBundle" """Deletes a key of any type from storage in Azure Key Vault. - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the keys/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to delete. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_key.metadata['url'] + url = self.delete_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} - - def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. - - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + def update_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of key to update. :type key_name: str :param key_version: The version of the key to update. :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v2016_10_01.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_key.metadata['url'] + url = self.update_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): + update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore + + def get_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Gets the public part of a stored key. - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to get. :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. + :param key_version: Adding the version parameter retrieves a specific version of a key. :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_key.metadata['url'] + url = self.get_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} + get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore def get_key_versions( - self, vault_base_url, key_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + key_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.KeyListResult"] """Retrieves a list of individual key versions with the same key name. - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_key_versions.metadata['url'] + url = self.get_key_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'key-name': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} + get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} # type: ignore def get_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.KeyListResult"] """List keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_keys.metadata['url'] + url = self.get_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_keys.metadata = {'url': '/keys'} - - def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_keys.metadata = {'url': '/keys'} # type: ignore + + def backup_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupKeyResult" + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupKeyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.backup_key.metadata['url'] + url = self.backup_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) + deserialized = self._deserialize('BackupKeyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): + backup_key.metadata = {'url': '/keys/{key-name}/backup'} # type: ignore + + def restore_key( + self, + vault_base_url, # type: str + key_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Restores a backed up key to a vault. - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. + :param key_bundle_backup: The backup blob associated with a key bundle. :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_key.metadata['url'] + url = self.restore_key.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + restore_key.metadata = {'url': '/keys/restore'} # type: ignore + + def encrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.encrypt.metadata['url'] + url = self.encrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} # type: ignore + + def decrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Decrypts a single block of encrypted data. - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.decrypt.metadata['url'] + url = self.decrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} # type: ignore + + def sign( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Creates a signature from a digest using the specified key. - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeySignParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.sign.metadata['url'] + url = self.sign.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeySignParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, cls=None, **kwargs): + sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} # type: ignore + + def verify( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + digest, # type: bytes + signature, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyVerifyResult" """Verifies a signature using a specified key. - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ECDSA256' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeySignatureAlgorithm :param digest: The digest used for signing. :type digest: bytes :param signature: The signature to be verified. :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVerifyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.verify.metadata['url'] + url = self.verify.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyVerifyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) + deserialized = self._deserialize('KeyVerifyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} # type: ignore + + def wrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Wraps a symmetric key using a specified key. - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.wrap_key.metadata['url'] + url = self.wrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} # type: ignore + + def unwrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v2016_10_01.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.unwrap_key.metadata['url'] + url = self.unwrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} + unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} # type: ignore def get_deleted_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedKeyListResult"] """Lists the deleted keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_keys.metadata['url'] + url = self.get_deleted_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedKeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedKeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + get_deleted_keys.metadata = {'url': '/deletedkeys'} # type: ignore + + def get_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedKeyBundle" """Gets the public part of a deleted key. - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_key.metadata['url'] + url = self.get_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore + + def purge_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified key. - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of the key + :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_key.metadata['url'] + url = self.purge_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore - def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + def recover_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Recovers the deleted key to its latest version. - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the deleted key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_key.metadata['url'] + url = self.recover_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, cls=None, **kwargs): + recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} # type: ignore + + def set_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + value, # type: str + tags=None, # type: Optional[Dict[str, str]] + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Sets a secret in a specified key vault. - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param value: The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type_parameter, secret_attributes=secret_attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_secret.metadata['url'] + url = self.set_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + set_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + def delete_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSecretBundle" """Deletes a secret from a specified key vault. - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_secret.metadata['url'] + url = self.delete_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + def update_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. - :type secret_attributes: - ~azure.keyvault.v2016_10_01.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type secret_attributes: ~azure.keyvault.v2016_10_01.models.SecretAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretUpdateParameters(content_type=content_type_parameter, secret_attributes=secret_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_secret.metadata['url'] + url = self.update_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kwargs): + update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore + + def get_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Get a specified secret from a given key vault. - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_secret.metadata['url'] + url = self.get_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} + get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore def get_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SecretListResult"] """List secrets in a specified key vault. - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secrets.metadata['url'] + url = self.get_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_secrets.metadata = {'url': '/secrets'} + get_secrets.metadata = {'url': '/secrets'} # type: ignore def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + secret_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SecretListResult"] """List all versions of the specified secret. - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secret_versions.metadata['url'] + url = self.get_secret_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} + get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} # type: ignore def get_deleted_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedSecretListResult"] """Lists deleted secrets for the specified vault. - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_secrets.metadata['url'] + url = self.get_deleted_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedSecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + get_deleted_secrets.metadata = {'url': '/deletedsecrets'} # type: ignore + + def get_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSecretBundle" """Gets the specified deleted secret. - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_secret.metadata['url'] + url = self.get_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + def purge_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified secret. - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_secret.metadata['url'] + url = self.purge_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} + return cls(pipeline_response, None, {}) - def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + def recover_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Recovers the deleted secret to the latest version. - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the deleted secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_secret.metadata['url'] + url = self.recover_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} # type: ignore + + def backup_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupSecretResult" """Backs up the specified secret. - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupSecretResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.backup_secret.metadata['url'] + url = self.backup_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) + deserialized = self._deserialize('BackupSecretResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwargs): + backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} # type: ignore + + def restore_secret( + self, + vault_base_url, # type: str + secret_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Restores a backed up secret to a vault. - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. + :param secret_bundle_backup: The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_secret.metadata['url'] + url = self.restore_secret.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} + restore_secret.metadata = {'url': '/secrets/restore'} # type: ignore def get_certificates( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + def delete_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + def set_certificate_contacts( + self, + vault_base_url, # type: str + contact_list=None, # type: Optional[List["models.Contact"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v2016_10_01.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def delete_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateIssuerListResult"] """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + def set_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider, # type: str + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. - :type credentials: - ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def update_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider=None, # type: Optional[str] + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. - :type credentials: - ~azure.keyvault.v2016_10_01.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v2016_10_01.models.OrganizationDetails + :type credentials: ~azure.keyvault.v2016_10_01.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v2016_10_01.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v2016_10_01.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def get_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def delete_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def create_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + def import_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + base64_encoded_certificate, # type: str + password=None, # type: Optional[str] + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + certificate_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + def get_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy, # type: "models.CertificatePolicy" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + 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_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v2016_10_01.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v2016_10_01.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def get_certificate(self, vault_base_url, certificate_name, certificate_version, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def get_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def update_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + cancellation_requested, # type: bool + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def get_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def delete_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def delete_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def merge_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + x509_certificates, # type: List[bytearray] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v2016_10_01.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v2016_10_01.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedCertificateListResult"] + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + def get_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def purge_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.purge_deleted_certificate.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def recover_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate + :param certificate_name: The name of the deleted certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.recover_deleted_certificate.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore def get_storage_accounts( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StorageListResult"] + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_storage_accounts.metadata['url'] + url = self.get_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('StorageListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('StorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_storage_accounts.metadata = {'url': '/storage'} - - def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_storage_accounts.metadata = {'url': '/storage'} # type: ignore + + def delete_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Deletes a storage account. This operation requires the storage/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_storage_account.metadata['url'] + url = self.delete_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def get_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. + delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def get_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Gets information about a specified storage account. This operation requires the storage/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_storage_account.metadata['url'] + url = self.get_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def set_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + resource_id, # type: str + active_key_name, # type: str + auto_regenerate_key, # type: bool + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str @@ -3942,534 +4224,571 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, :type resource_id: str :param active_key_name: Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_storage_account.metadata['url'] + url = self.set_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def update_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + active_key_name=None, # type: Optional[str] + auto_regenerate_key=None, # type: Optional[bool] + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v2016_10_01.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_storage_account.metadata['url'] + url = self.update_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def regenerate_storage_account_key( + self, + vault_base_url, # type: str + storage_account_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param key_name: The storage account key name. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] + url = self.regenerate_storage_account_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} + regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} # type: ignore def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + storage_account_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SasDefinitionListResult"] + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_sas_definitions.metadata['url'] + url = self.get_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SasDefinitionListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} - - def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} # type: ignore + + def delete_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.delete_sas_definition.metadata['url'] + url = self.delete_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def get_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "2016-10-01" + # Construct URL - url = self.get_sas_definition.metadata['url'] + url = self.get_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, parameters, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def set_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + parameters, # type: Dict[str, str] + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param parameters: Sas definition creation metadata in the form of - key-value pairs. + :param parameters: Sas definition creation metadata in the form of key-value pairs. :type parameters: dict[str, str] - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters1 = models.SasDefinitionCreateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionCreateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_sas_definition.metadata['url'] + url = self.set_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, parameters=None, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def update_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + parameters=None, # type: Optional[Dict[str, str]] + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param parameters: Sas definition update metadata in the form of - key-value pairs. + :param parameters: Sas definition update metadata in the form of key-value pairs. :type parameters: dict[str, str] - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v2016_10_01.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v2016_10_01.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters1 = models.SasDefinitionUpdateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionUpdateParameters(parameters=parameters, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_sas_definition.metadata['url'] + url = self.update_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/py.typed b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v2016_10_01/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/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-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/__init__.py index e913d4cf6c4..a6c1f9b7a79 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/__init__.py @@ -1,18 +1,16 @@ # 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 ._key_vault_client import KeyVaultClient __all__ = ['KeyVaultClient'] -from .version import VERSION - -__version__ = VERSION - +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_configuration.py index 68d6f5b6bd2..d440d2c0f5b 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_configuration.py @@ -1,43 +1,46 @@ # 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 TYPE_CHECKING + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from .version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "7.0" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +48,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_key_vault_client.py index a1a1eb19328..d9db79ab878 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_key_vault_client.py @@ -1,16 +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. -# +# 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 TYPE_CHECKING + from azure.core import PipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin @@ -20,27 +23,32 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs # type: Any + ): + # type: (...) -> None base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = PipelineClient(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 = '7.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) + def close(self): + # type: () -> None + self._client.close() + def __enter__(self): + # type: () -> KeyVaultClient self._client.__enter__() return self + def __exit__(self, *exc_details): + # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_metadata.json new file mode 100644 index 00000000000..9272a81de06 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/_metadata.json @@ -0,0 +1,969 @@ +{ + "chosen_version": "7.0", + "total_api_version_list": ["7.0"], + "client": { + "name": "KeyVaultClient", + "filename": "_key_vault_client", + "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", + "base_url": null, + "custom_base_url": "\u0027{vaultBaseUrl}\u0027", + "azure_arm": false + }, + "global_parameters": { + "sync_method": { + }, + "async_method": { + }, + "constant": { + }, + "call": "" + }, + "config": { + "credential": false, + "credential_scopes": null, + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + }, + "operation_mixins": { + "create_key" : { + "sync": { + "signature": "def create_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n kty, # type: Union[str, \"models.JsonWebKeyType\"]\n key_size=None, # type: Optional[int]\n key_ops=None, # type: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n curve=None, # type: Optional[Union[str, \"models.JsonWebKeyCurveName\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new key, stores it, then returns key parameters and attributes to the client.\n\nThe create key operation can be used to create any key type in Azure Key Vault. If the named\nkey already exists, Azure Key Vault creates a new version of the key. It requires the\nkeys/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name for the new key. The system will generate the version name for the\n new key.\n:type key_name: str\n:param kty: The type of key to create. For valid values, see JsonWebKeyType.\n:type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType\n:param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA.\n:type key_size: int\n:param key_ops:\n:type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName.\n:type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_key(\n self,\n vault_base_url: str,\n key_name: str,\n kty: Union[str, \"models.JsonWebKeyType\"],\n key_size: Optional[int] = None,\n key_ops: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n curve: Optional[Union[str, \"models.JsonWebKeyCurveName\"]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Creates a new key, stores it, then returns key parameters and attributes to the client.\n\nThe create key operation can be used to create any key type in Azure Key Vault. If the named\nkey already exists, Azure Key Vault creates a new version of the key. It requires the\nkeys/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name for the new key. The system will generate the version name for the\n new key.\n:type key_name: str\n:param kty: The type of key to create. For valid values, see JsonWebKeyType.\n:type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType\n:param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA.\n:type key_size: int\n:param key_ops:\n:type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName.\n:type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, kty, key_size, key_ops, key_attributes, tags, curve" + }, + "import_key" : { + "sync": { + "signature": "def import_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key, # type: \"models.JsonWebKey\"\n hsm=None, # type: Optional[bool]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the client.\n\nThe import key operation may be used to import any key type into an Azure Key Vault. If the\nnamed key already exists, Azure Key Vault creates a new version of the key. This operation\nrequires the keys/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: Name for the imported key.\n:type key_name: str\n:param key: The Json web key.\n:type key: ~azure.keyvault.v7_0.models.JsonWebKey\n:param hsm: Whether to import as a hardware key (HSM) or software key.\n:type hsm: bool\n:param key_attributes: The key management attributes.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_key(\n self,\n vault_base_url: str,\n key_name: str,\n key: \"models.JsonWebKey\",\n hsm: Optional[bool] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Imports an externally created key, stores it, and returns key parameters and attributes to the client.\n\nThe import key operation may be used to import any key type into an Azure Key Vault. If the\nnamed key already exists, Azure Key Vault creates a new version of the key. This operation\nrequires the keys/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: Name for the imported key.\n:type key_name: str\n:param key: The Json web key.\n:type key: ~azure.keyvault.v7_0.models.JsonWebKey\n:param hsm: Whether to import as a hardware key (HSM) or software key.\n:type hsm: bool\n:param key_attributes: The key management attributes.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key, hsm, key_attributes, tags" + }, + "delete_key" : { + "sync": { + "signature": "def delete_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a key of any type from storage in Azure Key Vault.\n\nThe delete key operation cannot be used to remove individual versions of a key. This operation\nremoves the cryptographic material associated with the key, which means the key is not usable\nfor Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the\nkeys/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to delete.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.DeletedKeyBundle\":\n", + "doc": "\"\"\"Deletes a key of any type from storage in Azure Key Vault.\n\nThe delete key operation cannot be used to remove individual versions of a key. This operation\nremoves the cryptographic material associated with the key, which means the key is not usable\nfor Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the\nkeys/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to delete.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "update_key" : { + "sync": { + "signature": "def update_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n key_ops=None, # type: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]]\n key_attributes=None, # type: Optional[\"models.KeyAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault.\n\nIn order to perform this operation, the key must already exist in the Key Vault. Note: The\ncryptographic material of a key itself cannot be changed. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of key to update.\n:type key_name: str\n:param key_version: The version of the key to update.\n:type key_version: str\n:param key_ops: Json web key operations. For more information on possible key operations, see\n JsonWebKeyOperation.\n:type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n key_ops: Optional[List[Union[str, \"models.JsonWebKeyOperation\"]]] = None,\n key_attributes: Optional[\"models.KeyAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault.\n\nIn order to perform this operation, the key must already exist in the Key Vault. Note: The\ncryptographic material of a key itself cannot be changed. This operation requires the\nkeys/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of key to update.\n:type key_name: str\n:param key_version: The version of the key to update.\n:type key_version: str\n:param key_ops: Json web key operations. For more information on possible key operations, see\n JsonWebKeyOperation.\n:type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation]\n:param key_attributes: The attributes of a key managed by the key vault service.\n:type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, key_ops, key_attributes, tags" + }, + "get_key" : { + "sync": { + "signature": "def get_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the public part of a stored key.\n\nThe get key operation is applicable to all key types. If the requested key is symmetric, then\nno key material is released in the response. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to get.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key. This\n URI fragment is optional. If not specified, the latest version of the key is returned.\n:type key_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Gets the public part of a stored key.\n\nThe get key operation is applicable to all key types. If the requested key is symmetric, then\nno key material is released in the response. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key to get.\n:type key_name: str\n:param key_version: Adding the version parameter retrieves a specific version of a key. This\n URI fragment is optional. If not specified, the latest version of the key is returned.\n:type key_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version" + }, + "get_key_versions" : { + "sync": { + "signature": "def get_key_versions(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves a list of individual key versions with the same key name.\n\nThe full key identifier, attributes, and tags are provided in the response. This operation\nrequires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_key_versions(\n self,\n vault_base_url: str,\n key_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.KeyListResult\"]:\n", + "doc": "\"\"\"Retrieves a list of individual key versions with the same key name.\n\nThe full key identifier, attributes, and tags are provided in the response. This operation\nrequires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, maxresults" + }, + "get_keys" : { + "sync": { + "signature": "def get_keys(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a stored key. The LIST operation is applicable to all key types, however only\nthe base key identifier, attributes, and tags are provided in the response. Individual versions\nof a key are not listed in the response. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.KeyListResult\"]:\n", + "doc": "\"\"\"List keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a stored key. The LIST operation is applicable to all key types, however only\nthe base key identifier, attributes, and tags are provided in the response. Individual versions\nof a key are not listed in the response. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either KeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "backup_key" : { + "sync": { + "signature": "def backup_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Requests that a backup of the specified key be downloaded to the client.\n\nThe Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this\noperation does NOT return key material in a form that can be used outside the Azure Key Vault\nsystem, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key\nVault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure\nKey Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance.\nThe BACKUP operation may be used to export, in protected form, any key type from Azure Key\nVault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed\nwithin geographical boundaries only; meaning that a BACKUP from one geographical area cannot be\nrestored to another geographical area. For example, a backup from the US geographical area\ncannot be restored in an EU geographical area. This operation requires the key/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupKeyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.BackupKeyResult\":\n", + "doc": "\"\"\"Requests that a backup of the specified key be downloaded to the client.\n\nThe Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this\noperation does NOT return key material in a form that can be used outside the Azure Key Vault\nsystem, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key\nVault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure\nKey Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance.\nThe BACKUP operation may be used to export, in protected form, any key type from Azure Key\nVault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed\nwithin geographical boundaries only; meaning that a BACKUP from one geographical area cannot be\nrestored to another geographical area. For example, a backup from the US geographical area\ncannot be restored in an EU geographical area. This operation requires the key/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupKeyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupKeyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "restore_key" : { + "sync": { + "signature": "def restore_key(\n self,\n vault_base_url, # type: str\n key_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up key to a vault.\n\nImports a previously backed up key into Azure Key Vault, restoring the key, its key identifier,\nattributes and access control policies. The RESTORE operation may be used to import a\npreviously backed up key. Individual versions of a key cannot be restored. The key is restored\nin its entirety with the same key name as it had when it was backed up. If the key name is not\navailable in the target Key Vault, the RESTORE operation will be rejected. While the key name\nis retained during restore, the final key identifier will change if the key is restored to a\ndifferent vault. Restore will restore all versions and preserve version identifiers. The\nRESTORE operation is subject to security constraints: The target Key Vault must be owned by the\nsame Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission\nin the target Key Vault. This operation requires the keys/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_bundle_backup: The backup blob associated with a key bundle.\n:type key_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_key(\n self,\n vault_base_url: str,\n key_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Restores a backed up key to a vault.\n\nImports a previously backed up key into Azure Key Vault, restoring the key, its key identifier,\nattributes and access control policies. The RESTORE operation may be used to import a\npreviously backed up key. Individual versions of a key cannot be restored. The key is restored\nin its entirety with the same key name as it had when it was backed up. If the key name is not\navailable in the target Key Vault, the RESTORE operation will be rejected. While the key name\nis retained during restore, the final key identifier will change if the key is restored to a\ndifferent vault. Restore will restore all versions and preserve version identifiers. The\nRESTORE operation is subject to security constraints: The target Key Vault must be owned by the\nsame Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission\nin the target Key Vault. This operation requires the keys/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_bundle_backup: The backup blob associated with a key bundle.\n:type key_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_bundle_backup" + }, + "encrypt" : { + "sync": { + "signature": "def encrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault.\n\nThe ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is\nstored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of\ndata, the size of which is dependent on the target key and the encryption algorithm to be used.\nThe ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault\nsince protection with an asymmetric key can be performed using public portion of the key. This\noperation is supported for asymmetric keys as a convenience for callers that have a key-\nreference but do not have access to the public key material. This operation requires the\nkeys/encrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def encrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault.\n\nThe ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is\nstored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of\ndata, the size of which is dependent on the target key and the encryption algorithm to be used.\nThe ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault\nsince protection with an asymmetric key can be performed using public portion of the key. This\noperation is supported for asymmetric keys as a convenience for callers that have a key-\nreference but do not have access to the public key material. This operation requires the\nkeys/encrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "decrypt" : { + "sync": { + "signature": "def decrypt(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Decrypts a single block of encrypted data.\n\nThe DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption\nkey and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a\nsingle block of data may be decrypted, the size of this block is dependent on the target key\nand the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys\nstored in Azure Key Vault since it uses the private portion of the key. This operation requires\nthe keys/decrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def decrypt(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Decrypts a single block of encrypted data.\n\nThe DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption\nkey and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a\nsingle block of data may be decrypted, the size of this block is dependent on the target key\nand the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys\nstored in Azure Key Vault since it uses the private portion of the key. This operation requires\nthe keys/decrypt permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "sign" : { + "sync": { + "signature": "def sign(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeySignatureAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a signature from a digest using the specified key.\n\nThe SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault\nsince this operation uses the private portion of the key. This operation requires the keys/sign\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm identifier. For more information on\n possible algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def sign(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeySignatureAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Creates a signature from a digest using the specified key.\n\nThe SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault\nsince this operation uses the private portion of the key. This operation requires the keys/sign\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm identifier. For more information on\n possible algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "verify" : { + "sync": { + "signature": "def verify(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeySignatureAlgorithm\"]\n digest, # type: bytes\n signature, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Verifies a signature using a specified key.\n\nThe VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not\nstrictly necessary for asymmetric keys stored in Azure Key Vault since signature verification\ncan be performed using the public portion of the key but this operation is supported as a\nconvenience for callers that only have a key-reference and not the public portion of the key.\nThis operation requires the keys/verify permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm. For more information on possible\n algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm\n:param digest: The digest used for signing.\n:type digest: bytes\n:param signature: The signature to be verified.\n:type signature: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyVerifyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def verify(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeySignatureAlgorithm\"],\n digest: bytes,\n signature: bytes,\n **kwargs\n) -\u003e \"models.KeyVerifyResult\":\n", + "doc": "\"\"\"Verifies a signature using a specified key.\n\nThe VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not\nstrictly necessary for asymmetric keys stored in Azure Key Vault since signature verification\ncan be performed using the public portion of the key but this operation is supported as a\nconvenience for callers that only have a key-reference and not the public portion of the key.\nThis operation requires the keys/verify permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: The signing/verification algorithm. For more information on possible\n algorithm types, see JsonWebKeySignatureAlgorithm.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm\n:param digest: The digest used for signing.\n:type digest: bytes\n:param signature: The signature to be verified.\n:type signature: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyVerifyResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, digest, signature" + }, + "wrap_key" : { + "sync": { + "signature": "def wrap_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Wraps a symmetric key using a specified key.\n\nThe WRAP operation supports encryption of a symmetric key using a key encryption key that has\npreviously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for\nsymmetric keys stored in Azure Key Vault since protection with an asymmetric key can be\nperformed using the public portion of the key. This operation is supported for asymmetric keys\nas a convenience for callers that have a key-reference but do not have access to the public key\nmaterial. This operation requires the keys/wrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def wrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Wraps a symmetric key using a specified key.\n\nThe WRAP operation supports encryption of a symmetric key using a key encryption key that has\npreviously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for\nsymmetric keys stored in Azure Key Vault since protection with an asymmetric key can be\nperformed using the public portion of the key. This operation is supported for asymmetric keys\nas a convenience for callers that have a key-reference but do not have access to the public key\nmaterial. This operation requires the keys/wrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "unwrap_key" : { + "sync": { + "signature": "def unwrap_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n key_version, # type: str\n algorithm, # type: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"]\n value, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Unwraps a symmetric key using the specified key that was initially used for wrapping that key.\n\nThe UNWRAP operation supports decryption of a symmetric key using the target key encryption\nkey. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to\nasymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of\nthe key. This operation requires the keys/unwrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def unwrap_key(\n self,\n vault_base_url: str,\n key_name: str,\n key_version: str,\n algorithm: Union[str, \"models.JsonWebKeyEncryptionAlgorithm\"],\n value: bytes,\n **kwargs\n) -\u003e \"models.KeyOperationResult\":\n", + "doc": "\"\"\"Unwraps a symmetric key using the specified key that was initially used for wrapping that key.\n\nThe UNWRAP operation supports decryption of a symmetric key using the target key encryption\nkey. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to\nasymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of\nthe key. This operation requires the keys/unwrapKey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:param key_version: The version of the key.\n:type key_version: str\n:param algorithm: algorithm identifier.\n:type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm\n:param value:\n:type value: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyOperationResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyOperationResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name, key_version, algorithm, value" + }, + "get_deleted_keys" : { + "sync": { + "signature": "def get_deleted_keys(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a deleted key. This operation includes deletion-specific information. The Get\nDeleted Keys operation is applicable for vaults enabled for soft-delete. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedKeyListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_keys(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedKeyListResult\"]:\n", + "doc": "\"\"\"Lists the deleted keys in the specified vault.\n\nRetrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the\npublic part of a deleted key. This operation includes deletion-specific information. The Get\nDeleted Keys operation is applicable for vaults enabled for soft-delete. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedKeyListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_key" : { + "sync": { + "signature": "def get_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the public part of a deleted key.\n\nThe Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.DeletedKeyBundle\":\n", + "doc": "\"\"\"Gets the public part of a deleted key.\n\nThe Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation\ncan be invoked on any vault, it will return an error if invoked on a non soft-delete enabled\nvault. This operation requires the keys/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedKeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "purge_deleted_key" : { + "sync": { + "signature": "def purge_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified key.\n\nThe Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the\noperation can be invoked on any vault, it will return an error if invoked on a non soft-delete\nenabled vault. This operation requires the keys/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified key.\n\nThe Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the\noperation can be invoked on any vault, it will return an error if invoked on a non soft-delete\nenabled vault. This operation requires the keys/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "recover_deleted_key" : { + "sync": { + "signature": "def recover_deleted_key(\n self,\n vault_base_url, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted key to its latest version.\n\nThe Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults.\nIt recovers the deleted key back to its latest version under /keys. An attempt to recover an\nnon-deleted key will return an error. Consider this the inverse of the delete operation on\nsoft-delete enabled vaults. This operation requires the keys/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the deleted key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_key(\n self,\n vault_base_url: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.KeyBundle\":\n", + "doc": "\"\"\"Recovers the deleted key to its latest version.\n\nThe Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults.\nIt recovers the deleted key back to its latest version under /keys. An attempt to recover an\nnon-deleted key will return an error. Consider this the inverse of the delete operation on\nsoft-delete enabled vaults. This operation requires the keys/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param key_name: The name of the deleted key.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: KeyBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.KeyBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, key_name" + }, + "set_secret" : { + "sync": { + "signature": "def set_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n value, # type: str\n tags=None, # type: Optional[Dict[str, str]]\n content_type_parameter=None, # type: Optional[str]\n secret_attributes=None, # type: Optional[\"models.SecretAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets a secret in a specified key vault.\n\nThe SET operation adds a secret to the Azure Key Vault. If the named secret already exists,\nAzure Key Vault creates a new version of that secret. This operation requires the secrets/set\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param value: The value of the secret.\n:type value: str\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n value: str,\n tags: Optional[Dict[str, str]] = None,\n content_type_parameter: Optional[str] = None,\n secret_attributes: Optional[\"models.SecretAttributes\"] = None,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Sets a secret in a specified key vault.\n\nThe SET operation adds a secret to the Azure Key Vault. If the named secret already exists,\nAzure Key Vault creates a new version of that secret. This operation requires the secrets/set\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param value: The value of the secret.\n:type value: str\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, value, tags, content_type_parameter, secret_attributes" + }, + "delete_secret" : { + "sync": { + "signature": "def delete_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a secret from a specified key vault.\n\nThe DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied\nto an individual version of a secret. This operation requires the secrets/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.DeletedSecretBundle\":\n", + "doc": "\"\"\"Deletes a secret from a specified key vault.\n\nThe DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied\nto an individual version of a secret. This operation requires the secrets/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "update_secret" : { + "sync": { + "signature": "def update_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n secret_version, # type: str\n content_type_parameter=None, # type: Optional[str]\n secret_attributes=None, # type: Optional[\"models.SecretAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the attributes associated with a specified secret in a given key vault.\n\nThe UPDATE operation changes specified attributes of an existing stored secret. Attributes that\nare not specified in the request are left unchanged. The value of a secret itself cannot be\nchanged. This operation requires the secrets/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n content_type_parameter: Optional[str] = None,\n secret_attributes: Optional[\"models.SecretAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Updates the attributes associated with a specified secret in a given key vault.\n\nThe UPDATE operation changes specified attributes of an existing stored secret. Attributes that\nare not specified in the request are left unchanged. The value of a secret itself cannot be\nchanged. This operation requires the secrets/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret.\n:type secret_version: str\n:param content_type_parameter: Type of the secret value such as a password.\n:type content_type_parameter: str\n:param secret_attributes: The secret management attributes.\n:type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, secret_version, content_type_parameter, secret_attributes, tags" + }, + "get_secret" : { + "sync": { + "signature": "def get_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n secret_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Get a specified secret from a given key vault.\n\nThe GET operation is applicable to any secret stored in Azure Key Vault. This operation\nrequires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret. This URI fragment is optional. If not\n specified, the latest version of the secret is returned.\n:type secret_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n secret_version: str,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Get a specified secret from a given key vault.\n\nThe GET operation is applicable to any secret stored in Azure Key Vault. This operation\nrequires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param secret_version: The version of the secret. This URI fragment is optional. If not\n specified, the latest version of the secret is returned.\n:type secret_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, secret_version" + }, + "get_secrets" : { + "sync": { + "signature": "def get_secrets(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List secrets in a specified key vault.\n\nThe Get Secrets operation is applicable to the entire vault. However, only the base secret\nidentifier and its attributes are provided in the response. Individual secret versions are not\nlisted in the response. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SecretListResult\"]:\n", + "doc": "\"\"\"List secrets in a specified key vault.\n\nThe Get Secrets operation is applicable to the entire vault. However, only the base secret\nidentifier and its attributes are provided in the response. Individual secret versions are not\nlisted in the response. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_secret_versions" : { + "sync": { + "signature": "def get_secret_versions(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List all versions of the specified secret.\n\nThe full secret identifier and attributes are provided in the response. No values are returned\nfor the secrets. This operations requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_secret_versions(\n self,\n vault_base_url: str,\n secret_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SecretListResult\"]:\n", + "doc": "\"\"\"List all versions of the specified secret.\n\nThe full secret identifier and attributes are provided in the response. No values are returned\nfor the secrets. This operations requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified, the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name, maxresults" + }, + "get_deleted_secrets" : { + "sync": { + "signature": "def get_deleted_secrets(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists deleted secrets for the specified vault.\n\nThe Get Deleted Secrets operation returns the secrets that have been deleted for a vault\nenabled for soft-delete. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSecretListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_secrets(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedSecretListResult\"]:\n", + "doc": "\"\"\"Lists deleted secrets for the specified vault.\n\nThe Get Deleted Secrets operation returns the secrets that have been deleted for a vault\nenabled for soft-delete. This operation requires the secrets/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSecretListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_secret" : { + "sync": { + "signature": "def get_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the specified deleted secret.\n\nThe Get Deleted Secret operation returns the specified deleted secret along with its\nattributes. This operation requires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.DeletedSecretBundle\":\n", + "doc": "\"\"\"Gets the specified deleted secret.\n\nThe Get Deleted Secret operation returns the specified deleted secret along with its\nattributes. This operation requires the secrets/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "purge_deleted_secret" : { + "sync": { + "signature": "def purge_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified secret.\n\nThe purge deleted secret operation removes the secret permanently, without the possibility of\nrecovery. This operation can only be enabled on a soft-delete enabled vault. This operation\nrequires the secrets/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified secret.\n\nThe purge deleted secret operation removes the secret permanently, without the possibility of\nrecovery. This operation can only be enabled on a soft-delete enabled vault. This operation\nrequires the secrets/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "recover_deleted_secret" : { + "sync": { + "signature": "def recover_deleted_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted secret to the latest version.\n\nRecovers the deleted secret in the specified vault. This operation can only be performed on a\nsoft-delete enabled vault. This operation requires the secrets/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Recovers the deleted secret to the latest version.\n\nRecovers the deleted secret in the specified vault. This operation can only be performed on a\nsoft-delete enabled vault. This operation requires the secrets/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the deleted secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "backup_secret" : { + "sync": { + "signature": "def backup_secret(\n self,\n vault_base_url, # type: str\n secret_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified secret.\n\nRequests that a backup of the specified secret be downloaded to the client. All versions of the\nsecret will be downloaded. This operation requires the secrets/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupSecretResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_secret(\n self,\n vault_base_url: str,\n secret_name: str,\n **kwargs\n) -\u003e \"models.BackupSecretResult\":\n", + "doc": "\"\"\"Backs up the specified secret.\n\nRequests that a backup of the specified secret be downloaded to the client. All versions of the\nsecret will be downloaded. This operation requires the secrets/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_name: The name of the secret.\n:type secret_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupSecretResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupSecretResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_name" + }, + "restore_secret" : { + "sync": { + "signature": "def restore_secret(\n self,\n vault_base_url, # type: str\n secret_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up secret to a vault.\n\nRestores a backed up secret, and all its versions, to a vault. This operation requires the\nsecrets/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_bundle_backup: The backup blob associated with a secret bundle.\n:type secret_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_secret(\n self,\n vault_base_url: str,\n secret_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.SecretBundle\":\n", + "doc": "\"\"\"Restores a backed up secret to a vault.\n\nRestores a backed up secret, and all its versions, to a vault. This operation requires the\nsecrets/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param secret_bundle_backup: The backup blob associated with a secret bundle.\n:type secret_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SecretBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SecretBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, secret_bundle_backup" + }, + "get_certificates" : { + "sync": { + "signature": "def get_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "delete_certificate" : { + "sync": { + "signature": "def delete_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "set_certificate_contacts" : { + "sync": { + "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contact_list=None, # type: Optional[List[\"models.Contact\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_0.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contact_list: Optional[List[\"models.Contact\"]] = None,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_0.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, contact_list" + }, + "get_certificate_contacts" : { + "sync": { + "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "delete_certificate_contacts" : { + "sync": { + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "get_certificate_issuers" : { + "sync": { + "signature": "def get_certificate_issuers(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateIssuerListResult\"]:\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "set_certificate_issuer" : { + "sync": { + "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider, # type: str\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: str,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "update_certificate_issuer" : { + "sync": { + "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider=None, # type: Optional[str]\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: Optional[str] = None,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "get_certificate_issuer" : { + "sync": { + "signature": "def get_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "delete_certificate_issuer" : { + "sync": { + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "create_certificate" : { + "sync": { + "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags" + }, + "import_certificate" : { + "sync": { + "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n base64_encoded_certificate, # type: str\n password=None, # type: Optional[str]\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n base64_encoded_certificate: str,\n password: Optional[str] = None,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags" + }, + "get_certificate_versions" : { + "sync": { + "signature": "def get_certificate_versions(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, maxresults" + }, + "get_certificate_policy" : { + "sync": { + "signature": "def get_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "update_certificate_policy" : { + "sync": { + "signature": "def update_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy, # type: \"models.CertificatePolicy\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: \"models.CertificatePolicy\",\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy" + }, + "update_certificate" : { + "sync": { + "signature": "def update_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags" + }, + "get_certificate" : { + "sync": { + "signature": "def get_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version" + }, + "update_certificate_operation" : { + "sync": { + "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n cancellation_requested, # type: bool\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n cancellation_requested: bool,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, cancellation_requested" + }, + "get_certificate_operation" : { + "sync": { + "signature": "def get_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "delete_certificate_operation" : { + "sync": { + "signature": "def delete_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "merge_certificate" : { + "sync": { + "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n x509_certificates, # type: List[bytearray]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n x509_certificates: List[bytearray],\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags" + }, + "backup_certificate" : { + "sync": { + "signature": "def backup_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.BackupCertificateResult\":\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "restore_certificate" : { + "sync": { + "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n certificate_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n certificate_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_bundle_backup" + }, + "get_deleted_certificates" : { + "sync": { + "signature": "def get_deleted_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedCertificateListResult\"]:\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "get_deleted_certificate" : { + "sync": { + "signature": "def get_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "purge_deleted_certificate" : { + "sync": { + "signature": "def purge_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "recover_deleted_certificate" : { + "sync": { + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "get_storage_accounts" : { + "sync": { + "signature": "def get_storage_accounts(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List storage accounts managed by the specified key vault. This operation requires the\nstorage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either StorageListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.StorageListResult\"]:\n", + "doc": "\"\"\"List storage accounts managed by the specified key vault. This operation requires the\nstorage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either StorageListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_storage_accounts" : { + "sync": { + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists deleted storage accounts for the specified vault.\n\nThe Get Deleted Storage Accounts operation returns the storage accounts that have been deleted\nfor a vault enabled for soft-delete. This operation requires the storage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedStorageListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_storage_accounts(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedStorageListResult\"]:\n", + "doc": "\"\"\"Lists deleted storage accounts for the specified vault.\n\nThe Get Deleted Storage Accounts operation returns the storage accounts that have been deleted\nfor a vault enabled for soft-delete. This operation requires the storage/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedStorageListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "get_deleted_storage_account" : { + "sync": { + "signature": "def get_deleted_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the specified deleted storage account.\n\nThe Get Deleted Storage Account operation returns the specified deleted storage account along\nwith its attributes. This operation requires the storage/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedStorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.DeletedStorageBundle\":\n", + "doc": "\"\"\"Gets the specified deleted storage account.\n\nThe Get Deleted Storage Account operation returns the specified deleted storage account along\nwith its attributes. This operation requires the storage/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedStorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "purge_deleted_storage_account" : { + "sync": { + "signature": "def purge_deleted_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified storage account.\n\nThe purge deleted storage account operation removes the secret permanently, without the\npossibility of recovery. This operation can only be performed on a soft-delete enabled vault.\nThis operation requires the storage/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified storage account.\n\nThe purge deleted storage account operation removes the secret permanently, without the\npossibility of recovery. This operation can only be performed on a soft-delete enabled vault.\nThis operation requires the storage/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "recover_deleted_storage_account" : { + "sync": { + "signature": "def recover_deleted_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted storage account.\n\nRecovers the deleted storage account in the specified vault. This operation can only be\nperformed on a soft-delete enabled vault. This operation requires the storage/recover\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Recovers the deleted storage account.\n\nRecovers the deleted storage account in the specified vault. This operation can only be\nperformed on a soft-delete enabled vault. This operation requires the storage/recover\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "backup_storage_account" : { + "sync": { + "signature": "def backup_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified storage account.\n\nRequests that a backup of the specified storage account be downloaded to the client. This\noperation requires the storage/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupStorageResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupStorageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.BackupStorageResult\":\n", + "doc": "\"\"\"Backs up the specified storage account.\n\nRequests that a backup of the specified storage account be downloaded to the client. This\noperation requires the storage/backup permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupStorageResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.BackupStorageResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "restore_storage_account" : { + "sync": { + "signature": "def restore_storage_account(\n self,\n vault_base_url, # type: str\n storage_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up storage account to a vault.\n\nRestores a backed up storage account to a vault. This operation requires the storage/restore\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_bundle_backup: The backup blob associated with a storage account.\n:type storage_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_storage_account(\n self,\n vault_base_url: str,\n storage_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Restores a backed up storage account to a vault.\n\nRestores a backed up storage account to a vault. This operation requires the storage/restore\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_bundle_backup: The backup blob associated with a storage account.\n:type storage_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_bundle_backup" + }, + "delete_storage_account" : { + "sync": { + "signature": "def delete_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a storage account. This operation requires the storage/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedStorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.DeletedStorageBundle\":\n", + "doc": "\"\"\"Deletes a storage account. This operation requires the storage/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedStorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "get_storage_account" : { + "sync": { + "signature": "def get_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a specified storage account. This operation requires the storage/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Gets information about a specified storage account. This operation requires the storage/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name" + }, + "set_storage_account" : { + "sync": { + "signature": "def set_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n resource_id, # type: str\n active_key_name, # type: str\n auto_regenerate_key, # type: bool\n regeneration_period=None, # type: Optional[str]\n storage_account_attributes=None, # type: Optional[\"models.StorageAccountAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates or updates a new storage account. This operation requires the storage/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param resource_id: Storage account resource id.\n:type resource_id: str\n:param active_key_name: Current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n resource_id: str,\n active_key_name: str,\n auto_regenerate_key: bool,\n regeneration_period: Optional[str] = None,\n storage_account_attributes: Optional[\"models.StorageAccountAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Creates or updates a new storage account. This operation requires the storage/set permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param resource_id: Storage account resource id.\n:type resource_id: str\n:param active_key_name: Current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags" + }, + "update_storage_account" : { + "sync": { + "signature": "def update_storage_account(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n active_key_name=None, # type: Optional[str]\n auto_regenerate_key=None, # type: Optional[bool]\n regeneration_period=None, # type: Optional[str]\n storage_account_attributes=None, # type: Optional[\"models.StorageAccountAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given storage account. This operation\nrequires the storage/set/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param active_key_name: The current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_storage_account(\n self,\n vault_base_url: str,\n storage_account_name: str,\n active_key_name: Optional[str] = None,\n auto_regenerate_key: Optional[bool] = None,\n regeneration_period: Optional[str] = None,\n storage_account_attributes: Optional[\"models.StorageAccountAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given storage account. This operation\nrequires the storage/set/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param active_key_name: The current active storage account key name.\n:type active_key_name: str\n:param auto_regenerate_key: whether keyvault should manage the storage account for the user.\n:type auto_regenerate_key: bool\n:param regeneration_period: The key regeneration time duration specified in ISO-8601 format.\n:type regeneration_period: str\n:param storage_account_attributes: The attributes of the storage account.\n:type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, active_key_name, auto_regenerate_key, regeneration_period, storage_account_attributes, tags" + }, + "regenerate_storage_account_key" : { + "sync": { + "signature": "def regenerate_storage_account_key(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n key_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Regenerates the specified key value for the given storage account. This operation requires the\nstorage/regeneratekey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param key_name: The storage account key name.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def regenerate_storage_account_key(\n self,\n vault_base_url: str,\n storage_account_name: str,\n key_name: str,\n **kwargs\n) -\u003e \"models.StorageBundle\":\n", + "doc": "\"\"\"Regenerates the specified key value for the given storage account. This operation requires the\nstorage/regeneratekey permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param key_name: The storage account key name.\n:type key_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: StorageBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.StorageBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, key_name" + }, + "get_sas_definitions" : { + "sync": { + "signature": "def get_sas_definitions(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List storage SAS definitions for the given storage account. This operation requires the\nstorage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.SasDefinitionListResult\"]:\n", + "doc": "\"\"\"List storage SAS definitions for the given storage account. This operation requires the\nstorage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either SasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, maxresults" + }, + "get_deleted_sas_definitions" : { + "sync": { + "signature": "def get_deleted_sas_definitions(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists deleted SAS definitions for the specified vault and storage account.\n\nThe Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted\nfor a vault enabled for soft-delete. This operation requires the storage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_sas_definitions(\n self,\n vault_base_url: str,\n storage_account_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedSasDefinitionListResult\"]:\n", + "doc": "\"\"\"Lists deleted SAS definitions for the specified vault and storage account.\n\nThe Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted\nfor a vault enabled for soft-delete. This operation requires the storage/listsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, maxresults" + }, + "get_deleted_sas_definition" : { + "sync": { + "signature": "def get_deleted_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the specified deleted sas definition.\n\nThe Get Deleted SAS Definition operation returns the specified deleted SAS definition along\nwith its attributes. This operation requires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.DeletedSasDefinitionBundle\":\n", + "doc": "\"\"\"Gets the specified deleted sas definition.\n\nThe Get Deleted SAS Definition operation returns the specified deleted SAS definition along\nwith its attributes. This operation requires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "recover_deleted_sas_definition" : { + "sync": { + "signature": "def recover_deleted_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted SAS definition.\n\nRecovers the deleted SAS definition for the specified storage account. This operation can only\nbe performed on a soft-delete enabled vault. This operation requires the storage/recover\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Recovers the deleted SAS definition.\n\nRecovers the deleted SAS definition for the specified storage account. This operation can only\nbe performed on a soft-delete enabled vault. This operation requires the storage/recover\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "delete_sas_definition" : { + "sync": { + "signature": "def delete_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a SAS definition from a specified storage account. This operation requires the\nstorage/deletesas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.DeletedSasDefinitionBundle\":\n", + "doc": "\"\"\"Deletes a SAS definition from a specified storage account. This operation requires the\nstorage/deletesas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedSasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "get_sas_definition" : { + "sync": { + "signature": "def get_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a SAS definition for the specified storage account. This operation\nrequires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Gets information about a SAS definition for the specified storage account. This operation\nrequires the storage/getsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name" + }, + "set_sas_definition" : { + "sync": { + "signature": "def set_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n template_uri, # type: str\n sas_type, # type: Union[str, \"models.SasTokenType\"]\n validity_period, # type: str\n sas_definition_attributes=None, # type: Optional[\"models.SasDefinitionAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates or updates a new SAS definition for the specified storage account. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param template_uri: The SAS definition token template signed with an arbitrary key. Tokens\n created according to the SAS definition will have the same properties as the template.\n:type template_uri: str\n:param sas_type: The type of SAS token the SAS definition will create.\n:type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType\n:param validity_period: The validity period of SAS tokens created according to the SAS\n definition.\n:type validity_period: str\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n template_uri: str,\n sas_type: Union[str, \"models.SasTokenType\"],\n validity_period: str,\n sas_definition_attributes: Optional[\"models.SasDefinitionAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Creates or updates a new SAS definition for the specified storage account. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param template_uri: The SAS definition token template signed with an arbitrary key. Tokens\n created according to the SAS definition will have the same properties as the template.\n:type template_uri: str\n:param sas_type: The type of SAS token the SAS definition will create.\n:type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType\n:param validity_period: The validity period of SAS tokens created according to the SAS\n definition.\n:type validity_period: str\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags" + }, + "update_sas_definition" : { + "sync": { + "signature": "def update_sas_definition(\n self,\n vault_base_url, # type: str\n storage_account_name, # type: str\n sas_definition_name, # type: str\n template_uri=None, # type: Optional[str]\n sas_type=None, # type: Optional[Union[str, \"models.SasTokenType\"]]\n validity_period=None, # type: Optional[str]\n sas_definition_attributes=None, # type: Optional[\"models.SasDefinitionAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given SAS definition. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param template_uri: The SAS definition token template signed with an arbitrary key. Tokens\n created according to the SAS definition will have the same properties as the template.\n:type template_uri: str\n:param sas_type: The type of SAS token the SAS definition will create.\n:type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType\n:param validity_period: The validity period of SAS tokens created according to the SAS\n definition.\n:type validity_period: str\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_sas_definition(\n self,\n vault_base_url: str,\n storage_account_name: str,\n sas_definition_name: str,\n template_uri: Optional[str] = None,\n sas_type: Optional[Union[str, \"models.SasTokenType\"]] = None,\n validity_period: Optional[str] = None,\n sas_definition_attributes: Optional[\"models.SasDefinitionAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.SasDefinitionBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given SAS definition. This operation\nrequires the storage/setsas permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param storage_account_name: The name of the storage account.\n:type storage_account_name: str\n:param sas_definition_name: The name of the SAS definition.\n:type sas_definition_name: str\n:param template_uri: The SAS definition token template signed with an arbitrary key. Tokens\n created according to the SAS definition will have the same properties as the template.\n:type template_uri: str\n:param sas_type: The type of SAS token the SAS definition will create.\n:type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType\n:param validity_period: The validity period of SAS tokens created according to the SAS\n definition.\n:type validity_period: str\n:param sas_definition_attributes: The attributes of the SAS definition.\n:type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: SasDefinitionBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes, tags" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\", \"Union\"]}}}" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/__init__.py index fb2e6c3866f..71ceadebe43 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/__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 ._key_vault_client_async import KeyVaultClient diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration_async.py index fb961bb4bd2..7c3a4f0647a 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_configuration_async.py @@ -1,43 +1,40 @@ # 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 + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from ..version import VERSION - +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs: Any + ) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "7.0" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +42,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client_async.py index 482d6336ab1..2d273c4e45f 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/_key_vault_client_async.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 typing import Any + from azure.core import AsyncPipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer from ._configuration_async import KeyVaultClientConfiguration from .operations_async import KeyVaultClientOperationsMixin @@ -20,27 +19,28 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs: Any + ) -> None: base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = AsyncPipelineClient(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 = '7.0' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - async def __aenter__(self): + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/__init__.py index 771a17ceb80..b887c97a420 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/__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 ._key_vault_client_operations_async import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py index 1675be60f93..67097e0842b 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py @@ -1,2524 +1,2674 @@ # 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, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings -from azure.core.exceptions import map_error 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 ... import models -import uuid +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeyVaultClientOperationsMixin: - async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, *, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. - - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + async def create_key( + self, + vault_base_url: str, + key_name: str, + kty: Union[str, "models.JsonWebKeyType"], + key_size: Optional[int] = None, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + curve: Optional[Union[str, "models.JsonWebKeyCurveName"]] = None, + **kwargs + ) -> "models.KeyBundle": + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. + :param key_name: The name for the new key. The system will generate the version name for the + new key. :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' + :param kty: The type of key to create. For valid values, see JsonWebKeyType. :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_key.metadata['url'] + url = self.create_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + create_key.metadata = {'url': '/keys/{key-name}/create'} # type: ignore + + async def import_key( + self, + vault_base_url: str, + key_name: str, + key: "models.JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: Name for the imported key. :type key_name: str - :param key: The Json web key + :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_key.metadata['url'] + url = self.import_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + import_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + async def delete_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": """Deletes a key of any type from storage in Azure Key Vault. - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the keys/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to delete. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_key.metadata['url'] + url = self.delete_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} - - async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. - - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + async def update_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + key_ops: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] = None, + key_attributes: Optional["models.KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.KeyBundle": + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of key to update. :type key_name: str :param key_version: The version of the key to update. :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_key.metadata['url'] + url = self.update_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kwargs): + update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore + + async def get_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + **kwargs + ) -> "models.KeyBundle": """Gets the public part of a stored key. - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to get. :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. + :param key_version: Adding the version parameter retrieves a specific version of a key. This + URI fragment is optional. If not specified, the latest version of the key is returned. :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_key.metadata['url'] + url = self.get_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} + get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore def get_key_versions( - self, vault_base_url, key_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + key_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.KeyListResult"]: """Retrieves a list of individual key versions with the same key name. - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_key_versions.metadata['url'] + url = self.get_key_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'key-name': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} + get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} # type: ignore def get_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.KeyListResult"]: """List keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_keys.metadata['url'] + url = self.get_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_keys.metadata = {'url': '/keys'} - - async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_keys.metadata = {'url': '/keys'} # type: ignore + + async def backup_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.BackupKeyResult": + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupKeyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_key.metadata['url'] + url = self.backup_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) + deserialized = self._deserialize('BackupKeyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kwargs): + backup_key.metadata = {'url': '/keys/{key-name}/backup'} # type: ignore + + async def restore_key( + self, + vault_base_url: str, + key_bundle_backup: bytes, + **kwargs + ) -> "models.KeyBundle": """Restores a backed up key to a vault. - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. + :param key_bundle_backup: The backup blob associated with a key bundle. :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_key.metadata['url'] + url = self.restore_key.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + restore_key.metadata = {'url': '/keys/restore'} # type: ignore + + async def encrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.encrypt.metadata['url'] + url = self.encrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} # type: ignore + + async def decrypt( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Decrypts a single block of encrypted data. - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.decrypt.metadata['url'] + url = self.decrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} # type: ignore + + async def sign( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Creates a signature from a digest using the specified key. - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeySignParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.sign.metadata['url'] + url = self.sign.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeySignParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, *, cls=None, **kwargs): + sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} # type: ignore + + async def verify( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, + **kwargs + ) -> "models.KeyVerifyResult": """Verifies a signature using a specified key. - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param digest: The digest used for signing. :type digest: bytes :param signature: The signature to be verified. :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVerifyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.verify.metadata['url'] + url = self.verify.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyVerifyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) + deserialized = self._deserialize('KeyVerifyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): + verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} # type: ignore + + async def wrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": """Wraps a symmetric key using a specified key. - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.wrap_key.metadata['url'] + url = self.wrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} # type: ignore + + async def unwrap_key( + self, + vault_base_url: str, + key_name: str, + key_version: str, + algorithm: Union[str, "models.JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ) -> "models.KeyOperationResult": + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.unwrap_key.metadata['url'] + url = self.unwrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} + unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} # type: ignore def get_deleted_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedKeyListResult"]: """Lists the deleted keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_keys.metadata['url'] + url = self.get_deleted_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedKeyListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedKeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + get_deleted_keys.metadata = {'url': '/deletedkeys'} # type: ignore + + async def get_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.DeletedKeyBundle": """Gets the public part of a deleted key. - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_key.metadata['url'] + url = self.get_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore + + async def purge_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> None: """Permanently deletes the specified key. - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of the key + :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_key.metadata['url'] + url = self.purge_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore - async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): + async def recover_deleted_key( + self, + vault_base_url: str, + key_name: str, + **kwargs + ) -> "models.KeyBundle": """Recovers the deleted key to its latest version. - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the deleted key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_key.metadata['url'] + url = self.recover_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - async def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, *, cls=None, **kwargs): + recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} # type: ignore + + async def set_secret( + self, + vault_base_url: str, + secret_name: str, + value: str, + tags: Optional[Dict[str, str]] = None, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + **kwargs + ) -> "models.SecretBundle": """Sets a secret in a specified key vault. - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param value: The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type_parameter, secret_attributes=secret_attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_secret.metadata['url'] + url = self.set_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + set_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + async def delete_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": """Deletes a secret from a specified key vault. - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_secret.metadata['url'] + url = self.delete_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + async def update_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + content_type_parameter: Optional[str] = None, + secret_attributes: Optional["models.SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SecretBundle": + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretUpdateParameters(content_type=content_type_parameter, secret_attributes=secret_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_secret.metadata['url'] + url = self.update_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=None, **kwargs): + update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore + + async def get_secret( + self, + vault_base_url: str, + secret_name: str, + secret_version: str, + **kwargs + ) -> "models.SecretBundle": """Get a specified secret from a given key vault. - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. This URI fragment is optional. If not + specified, the latest version of the secret is returned. :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_secret.metadata['url'] + url = self.get_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} + get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore def get_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SecretListResult"]: """List secrets in a specified key vault. - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secrets.metadata['url'] + url = self.get_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_secrets.metadata = {'url': '/secrets'} + get_secrets.metadata = {'url': '/secrets'} # type: ignore def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + secret_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SecretListResult"]: """List all versions of the specified secret. - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secret_versions.metadata['url'] + url = self.get_secret_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} + get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} # type: ignore def get_deleted_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedSecretListResult"]: """Lists deleted secrets for the specified vault. - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_secrets.metadata['url'] + url = self.get_deleted_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedSecretListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + get_deleted_secrets.metadata = {'url': '/deletedsecrets'} # type: ignore + + async def get_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.DeletedSecretBundle": """Gets the specified deleted secret. - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_secret.metadata['url'] + url = self.get_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + async def purge_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> None: """Permanently deletes the specified secret. - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_secret.metadata['url'] + url = self.purge_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} + return cls(pipeline_response, None, {}) - async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + async def recover_deleted_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.SecretBundle": """Recovers the deleted secret to the latest version. - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the deleted secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_secret.metadata['url'] + url = self.recover_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): + recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} # type: ignore + + async def backup_secret( + self, + vault_base_url: str, + secret_name: str, + **kwargs + ) -> "models.BackupSecretResult": """Backs up the specified secret. - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupSecretResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_secret.metadata['url'] + url = self.backup_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) + deserialized = self._deserialize('BackupSecretResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None, **kwargs): + backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} # type: ignore + + async def restore_secret( + self, + vault_base_url: str, + secret_bundle_backup: bytes, + **kwargs + ) -> "models.SecretBundle": """Restores a backed up secret to a vault. - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. + :param secret_bundle_backup: The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_secret.metadata['url'] + url = self.restore_secret.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} + restore_secret.metadata = {'url': '/secrets/restore'} # type: ignore def get_certificates( - self, vault_base_url, maxresults=None, include_pending=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + async def delete_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + async def set_certificate_contacts( + self, + vault_base_url: str, + contact_list: Optional[List["models.Contact"]] = None, + **kwargs + ) -> "models.Contacts": """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v7_0.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def get_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def delete_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateIssuerListResult"]: """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: str, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -2526,72 +2676,77 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: Optional[str] = None, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -2599,1821 +2754,1919 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def get_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def delete_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateOperation": """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - async def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + async def get_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificatePolicy": """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, *, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: "models.CertificatePolicy", + **kwargs + ) -> "models.CertificatePolicy": """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def get_certificate(self, vault_base_url, certificate_name, certificate_version, *, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def get_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs + ) -> "models.CertificateBundle": """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, *, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + cancellation_requested: bool, + **kwargs + ) -> "models.CertificateOperation": """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def get_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def get_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def delete_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def delete_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, *, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + x509_certificates: List[bytearray], + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} - - async def backup_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + async def backup_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.BackupCertificateResult": """Backs up the specified certificate. - Requests that a backup of the specified certificate be downloaded to - the client. All versions of the certificate will be downloaded. This - operation requires the certificates/backup permission. + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupCertificateResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_certificate.metadata['url'] + url = self.backup_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupCertificateResult', response) + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} - - async def restore_certificate(self, vault_base_url, certificate_bundle_backup, *, cls=None, **kwargs): + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + async def restore_certificate( + self, + vault_base_url: str, + certificate_bundle_backup: bytes, + **kwargs + ) -> "models.CertificateBundle": """Restores a backed up certificate to a vault. - Restores a backed up certificate, and all its versions, to a vault. - This operation requires the certificates/restore permission. + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_bundle_backup: The backup blob associated with a - certificate bundle. + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. :type certificate_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_certificate.metadata['url'] + url = self.restore_certificate.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': '/certificates/restore'} + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, include_pending=None, *, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.DeletedCertificateListResult"]: + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + async def get_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def purge_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> None: """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_certificate.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def recover_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateBundle": + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate + :param certificate_name: The name of the deleted certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_certificate.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore def get_storage_accounts( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.StorageListResult"]: + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_storage_accounts.metadata['url'] + url = self.get_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('StorageListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('StorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_storage_accounts.metadata = {'url': '/storage'} + get_storage_accounts.metadata = {'url': '/storage'} # type: ignore def get_deleted_storage_accounts( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedStorageListResult"]: """Lists deleted storage accounts for the specified vault. - The Get Deleted Storage Accounts operation returns the storage accounts - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/list permission. + The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedStorageAccountItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedStorageListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_storage_accounts.metadata['url'] + url = self.get_deleted_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedStorageListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedStorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} - - async def get_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): + get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} # type: ignore + + async def get_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.DeletedStorageBundle": """Gets the specified deleted storage account. - The Get Deleted Storage Account operation returns the specified deleted - storage account along with its attributes. This operation requires the - storage/get permission. + The Get Deleted Storage Account operation returns the specified deleted storage account along + with its attributes. This operation requires the storage/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_storage_account.metadata['url'] + url = self.get_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) + deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - async def purge_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): + get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} # type: ignore + + async def purge_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> None: """Permanently deletes the specified storage account. - The purge deleted storage account operation removes the secret - permanently, without the possibility of recovery. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the storage/purge permission. + The purge deleted storage account operation removes the secret permanently, without the + possibility of recovery. This operation can only be performed on a soft-delete enabled vault. + This operation requires the storage/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_storage_account.metadata['url'] + url = self.purge_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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 [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} + return cls(pipeline_response, None, {}) - async def recover_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): + purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} # type: ignore + + async def recover_deleted_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": """Recovers the deleted storage account. - Recovers the deleted storage account in the specified vault. This - operation can only be performed on a soft-delete enabled vault. This - operation requires the storage/recover permission. + Recovers the deleted storage account in the specified vault. This operation can only be + performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_storage_account.metadata['url'] + url = self.recover_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} - - async def backup_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): + recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} # type: ignore + + async def backup_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.BackupStorageResult": """Backs up the specified storage account. - Requests that a backup of the specified storage account be downloaded - to the client. This operation requires the storage/backup permission. + Requests that a backup of the specified storage account be downloaded to the client. This + operation requires the storage/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupStorageResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStorageResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupStorageResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_storage_account.metadata['url'] + url = self.backup_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupStorageResult', response) + deserialized = self._deserialize('BackupStorageResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} - - async def restore_storage_account(self, vault_base_url, storage_bundle_backup, *, cls=None, **kwargs): + backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} # type: ignore + + async def restore_storage_account( + self, + vault_base_url: str, + storage_bundle_backup: bytes, + **kwargs + ) -> "models.StorageBundle": """Restores a backed up storage account to a vault. - Restores a backed up storage account to a vault. This operation - requires the storage/restore permission. + Restores a backed up storage account to a vault. This operation requires the storage/restore + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param storage_bundle_backup: The backup blob associated with a - storage account. + :param storage_bundle_backup: The backup blob associated with a storage account. :type storage_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_storage_account.metadata['url'] + url = self.restore_storage_account.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': '/storage/restore'} + restore_storage_account.metadata = {'url': '/storage/restore'} # type: ignore - async def delete_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. + async def delete_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.DeletedStorageBundle": + """Deletes a storage account. This operation requires the storage/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_storage_account.metadata['url'] + url = self.delete_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) + deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def get_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. + delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def get_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + **kwargs + ) -> "models.StorageBundle": + """Gets information about a specified storage account. This operation requires the storage/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_storage_account.metadata['url'] + url = self.get_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def set_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + resource_id: str, + active_key_name: str, + auto_regenerate_key: bool, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str @@ -4421,743 +4674,790 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour :type resource_id: str :param active_key_name: Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_storage_account.metadata['url'] + url = self.set_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def update_storage_account( + self, + vault_base_url: str, + storage_account_name: str, + active_key_name: Optional[str] = None, + auto_regenerate_key: Optional[bool] = None, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["models.StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.StorageBundle": + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_storage_account.metadata['url'] + url = self.update_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, *, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + async def regenerate_storage_account_key( + self, + vault_base_url: str, + storage_account_name: str, + key_name: str, + **kwargs + ) -> "models.StorageBundle": + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param key_name: The storage account key name. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] + url = self.regenerate_storage_account_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} + regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} # type: ignore def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, *, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.SasDefinitionListResult"]: + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_sas_definitions.metadata['url'] + url = self.get_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('SasDefinitionListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('SasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} + get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} # type: ignore def get_deleted_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, *, cls=None, **kwargs): - """Lists deleted SAS definitions for the specified vault and storage - account. - - The Get Deleted Sas Definitions operation returns the SAS definitions - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url: str, + storage_account_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.DeletedSasDefinitionListResult"]: + """Lists deleted SAS definitions for the specified vault and storage account. + + The Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSasDefinitionItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_sas_definitions.metadata['url'] + url = self.get_deleted_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} - - async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): + get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} # type: ignore + + async def get_deleted_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.DeletedSasDefinitionBundle": """Gets the specified deleted sas definition. - The Get Deleted SAS Definition operation returns the specified deleted - SAS definition along with its attributes. This operation requires the - storage/getsas permission. + The Get Deleted SAS Definition operation returns the specified deleted SAS definition along + with its attributes. This operation requires the storage/getsas permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_sas_definition.metadata['url'] + url = self.get_deleted_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) + deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} - - async def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): + get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def recover_deleted_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": """Recovers the deleted SAS definition. - Recovers the deleted SAS definition for the specified storage account. - This operation can only be performed on a soft-delete enabled vault. - This operation requires the storage/recover permission. + Recovers the deleted SAS definition for the specified storage account. This operation can only + be performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_sas_definition.metadata['url'] + url = self.recover_deleted_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} - - async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} # type: ignore + + async def delete_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.DeletedSasDefinitionBundle": + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_sas_definition.metadata['url'] + url = self.delete_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) + deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def get_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + **kwargs + ) -> "models.SasDefinitionBundle": + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_sas_definition.metadata['url'] + url = self.get_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def set_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + template_uri: str, + sas_type: Union[str, "models.SasTokenType"], + validity_period: str, + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS + :param validity_period: The validity period of SAS tokens created according to the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_sas_definition.metadata['url'] + url = self.set_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri=None, sas_type=None, validity_period=None, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + async def update_sas_definition( + self, + vault_base_url: str, + storage_account_name: str, + sas_definition_name: str, + template_uri: Optional[str] = None, + sas_type: Optional[Union[str, "models.SasTokenType"]] = None, + validity_period: Optional[str] = None, + sas_definition_attributes: Optional["models.SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.SasDefinitionBundle": + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS + :param validity_period: The validity period of SAS tokens created according to the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_sas_definition.metadata['url'] + url = self.update_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/__init__.py index 5e72f49a73f..433900a34cf 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/__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. # -------------------------------------------------------------------------- try: @@ -68,7 +65,7 @@ from ._models_py3 import KeyRestoreParameters from ._models_py3 import KeySignParameters from ._models_py3 import KeyUpdateParameters - from ._models_py3 import KeyVaultError, KeyVaultErrorException + from ._models_py3 import KeyVaultError from ._models_py3 import KeyVerifyParameters from ._models_py3 import KeyVerifyResult from ._models_py3 import LifetimeAction @@ -100,104 +97,105 @@ from ._models_py3 import Trigger from ._models_py3 import X509CertificateProperties except (SyntaxError, ImportError): - from ._models import Action - from ._models import AdministratorDetails - from ._models import Attributes - from ._models import BackupCertificateResult - from ._models import BackupKeyResult - from ._models import BackupSecretResult - from ._models import BackupStorageResult - from ._models import CertificateAttributes - from ._models import CertificateBundle - from ._models import CertificateCreateParameters - from ._models import CertificateImportParameters - from ._models import CertificateIssuerItem - from ._models import CertificateIssuerListResult - from ._models import CertificateIssuerSetParameters - from ._models import CertificateIssuerUpdateParameters - from ._models import CertificateItem - from ._models import CertificateListResult - from ._models import CertificateMergeParameters - from ._models import CertificateOperation - from ._models import CertificateOperationUpdateParameter - from ._models import CertificatePolicy - from ._models import CertificateRestoreParameters - from ._models import CertificateUpdateParameters - from ._models import Contact - from ._models import Contacts - from ._models import DeletedCertificateBundle - from ._models import DeletedCertificateItem - from ._models import DeletedCertificateListResult - from ._models import DeletedKeyBundle - from ._models import DeletedKeyItem - from ._models import DeletedKeyListResult - from ._models import DeletedSasDefinitionBundle - from ._models import DeletedSasDefinitionItem - from ._models import DeletedSasDefinitionListResult - from ._models import DeletedSecretBundle - from ._models import DeletedSecretItem - from ._models import DeletedSecretListResult - from ._models import DeletedStorageAccountItem - from ._models import DeletedStorageBundle - from ._models import DeletedStorageListResult - from ._models import Error - from ._models import IssuerAttributes - from ._models import IssuerBundle - from ._models import IssuerCredentials - from ._models import IssuerParameters - from ._models import JsonWebKey - from ._models import KeyAttributes - from ._models import KeyBundle - from ._models import KeyCreateParameters - from ._models import KeyImportParameters - from ._models import KeyItem - from ._models import KeyListResult - from ._models import KeyOperationResult - from ._models import KeyOperationsParameters - from ._models import KeyProperties - from ._models import KeyRestoreParameters - from ._models import KeySignParameters - from ._models import KeyUpdateParameters - from ._models import KeyVaultError, KeyVaultErrorException - from ._models import KeyVerifyParameters - from ._models import KeyVerifyResult - from ._models import LifetimeAction - from ._models import OrganizationDetails - from ._models import PendingCertificateSigningRequestResult - from ._models import SasDefinitionAttributes - from ._models import SasDefinitionBundle - from ._models import SasDefinitionCreateParameters - from ._models import SasDefinitionItem - from ._models import SasDefinitionListResult - from ._models import SasDefinitionUpdateParameters - from ._models import SecretAttributes - from ._models import SecretBundle - from ._models import SecretItem - from ._models import SecretListResult - from ._models import SecretProperties - from ._models import SecretRestoreParameters - from ._models import SecretSetParameters - from ._models import SecretUpdateParameters - from ._models import StorageAccountAttributes - from ._models import StorageAccountCreateParameters - from ._models import StorageAccountItem - from ._models import StorageAccountRegenerteKeyParameters - from ._models import StorageAccountUpdateParameters - from ._models import StorageBundle - from ._models import StorageListResult - from ._models import StorageRestoreParameters - from ._models import SubjectAlternativeNames - from ._models import Trigger - from ._models import X509CertificateProperties + from ._models import Action # type: ignore + from ._models import AdministratorDetails # type: ignore + from ._models import Attributes # type: ignore + from ._models import BackupCertificateResult # type: ignore + from ._models import BackupKeyResult # type: ignore + from ._models import BackupSecretResult # type: ignore + from ._models import BackupStorageResult # type: ignore + from ._models import CertificateAttributes # type: ignore + from ._models import CertificateBundle # type: ignore + from ._models import CertificateCreateParameters # type: ignore + from ._models import CertificateImportParameters # type: ignore + from ._models import CertificateIssuerItem # type: ignore + from ._models import CertificateIssuerListResult # type: ignore + from ._models import CertificateIssuerSetParameters # type: ignore + from ._models import CertificateIssuerUpdateParameters # type: ignore + from ._models import CertificateItem # type: ignore + from ._models import CertificateListResult # type: ignore + from ._models import CertificateMergeParameters # type: ignore + from ._models import CertificateOperation # type: ignore + from ._models import CertificateOperationUpdateParameter # type: ignore + from ._models import CertificatePolicy # type: ignore + from ._models import CertificateRestoreParameters # type: ignore + from ._models import CertificateUpdateParameters # type: ignore + from ._models import Contact # type: ignore + from ._models import Contacts # type: ignore + from ._models import DeletedCertificateBundle # type: ignore + from ._models import DeletedCertificateItem # type: ignore + from ._models import DeletedCertificateListResult # type: ignore + from ._models import DeletedKeyBundle # type: ignore + from ._models import DeletedKeyItem # type: ignore + from ._models import DeletedKeyListResult # type: ignore + from ._models import DeletedSasDefinitionBundle # type: ignore + from ._models import DeletedSasDefinitionItem # type: ignore + from ._models import DeletedSasDefinitionListResult # type: ignore + from ._models import DeletedSecretBundle # type: ignore + from ._models import DeletedSecretItem # type: ignore + from ._models import DeletedSecretListResult # type: ignore + from ._models import DeletedStorageAccountItem # type: ignore + from ._models import DeletedStorageBundle # type: ignore + from ._models import DeletedStorageListResult # type: ignore + from ._models import Error # type: ignore + from ._models import IssuerAttributes # type: ignore + from ._models import IssuerBundle # type: ignore + from ._models import IssuerCredentials # type: ignore + from ._models import IssuerParameters # type: ignore + from ._models import JsonWebKey # type: ignore + from ._models import KeyAttributes # type: ignore + from ._models import KeyBundle # type: ignore + from ._models import KeyCreateParameters # type: ignore + from ._models import KeyImportParameters # type: ignore + from ._models import KeyItem # type: ignore + from ._models import KeyListResult # type: ignore + from ._models import KeyOperationResult # type: ignore + from ._models import KeyOperationsParameters # type: ignore + from ._models import KeyProperties # type: ignore + from ._models import KeyRestoreParameters # type: ignore + from ._models import KeySignParameters # type: ignore + from ._models import KeyUpdateParameters # type: ignore + from ._models import KeyVaultError # type: ignore + from ._models import KeyVerifyParameters # type: ignore + from ._models import KeyVerifyResult # type: ignore + from ._models import LifetimeAction # type: ignore + from ._models import OrganizationDetails # type: ignore + from ._models import PendingCertificateSigningRequestResult # type: ignore + from ._models import SasDefinitionAttributes # type: ignore + from ._models import SasDefinitionBundle # type: ignore + from ._models import SasDefinitionCreateParameters # type: ignore + from ._models import SasDefinitionItem # type: ignore + from ._models import SasDefinitionListResult # type: ignore + from ._models import SasDefinitionUpdateParameters # type: ignore + from ._models import SecretAttributes # type: ignore + from ._models import SecretBundle # type: ignore + from ._models import SecretItem # type: ignore + from ._models import SecretListResult # type: ignore + from ._models import SecretProperties # type: ignore + from ._models import SecretRestoreParameters # type: ignore + from ._models import SecretSetParameters # type: ignore + from ._models import SecretUpdateParameters # type: ignore + from ._models import StorageAccountAttributes # type: ignore + from ._models import StorageAccountCreateParameters # type: ignore + from ._models import StorageAccountItem # type: ignore + from ._models import StorageAccountRegenerteKeyParameters # type: ignore + from ._models import StorageAccountUpdateParameters # type: ignore + from ._models import StorageBundle # type: ignore + from ._models import StorageListResult # type: ignore + from ._models import StorageRestoreParameters # type: ignore + from ._models import SubjectAlternativeNames # type: ignore + from ._models import Trigger # type: ignore + from ._models import X509CertificateProperties # type: ignore + from ._key_vault_client_enums import ( - JsonWebKeyType, - JsonWebKeyCurveName, - DeletionRecoveryLevel, - KeyUsageType, ActionType, - JsonWebKeyOperation, + DeletionRecoveryLevel, + JsonWebKeyCurveName, JsonWebKeyEncryptionAlgorithm, + JsonWebKeyOperation, JsonWebKeySignatureAlgorithm, + JsonWebKeyType, + KeyUsageType, SasTokenType, ) @@ -260,7 +258,7 @@ 'KeyRestoreParameters', 'KeySignParameters', 'KeyUpdateParameters', - 'KeyVaultError', 'KeyVaultErrorException', + 'KeyVaultError', 'KeyVerifyParameters', 'KeyVerifyResult', 'LifetimeAction', @@ -291,13 +289,13 @@ 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'JsonWebKeyType', - 'JsonWebKeyCurveName', - 'DeletionRecoveryLevel', - 'KeyUsageType', 'ActionType', - 'JsonWebKeyOperation', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', 'JsonWebKeyEncryptionAlgorithm', + 'JsonWebKeyOperation', 'JsonWebKeySignatureAlgorithm', + 'JsonWebKeyType', + 'KeyUsageType', 'SasTokenType', ] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_key_vault_client_enums.py index 046a304e990..9b943cc058c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_key_vault_client_enums.py @@ -1,62 +1,51 @@ # 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 ActionType(str, Enum): + """The type of the action. + """ -class JsonWebKeyType(str, Enum): - - ec = "EC" #: Elliptic Curve. - ec_hsm = "EC-HSM" #: Elliptic Curve with a private key which is not exportable from the HSM. - rsa = "RSA" #: RSA (https://tools.ietf.org/html/rfc3447) - rsa_hsm = "RSA-HSM" #: RSA with a private key which is not exportable from the HSM. - oct = "oct" #: Octet sequence (used to represent symmetric keys) - - -class JsonWebKeyCurveName(str, Enum): - - p_256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. - p_384 = "P-384" #: The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. - p_521 = "P-521" #: The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. - p_256_k = "P-256K" #: The SECG SECP256K1 elliptic curve. - + email_contacts = "EmailContacts" + auto_renew = "AutoRenew" class DeletionRecoveryLevel(str, Enum): + """Reflects the deletion recovery level currently in effect for keys in the current vault. If it + contains 'Purgeable' the key can be permanently deleted by a privileged user; otherwise, only + the system can purge the key, at the end of the retention interval. + """ purgeable = "Purgeable" recoverable_purgeable = "Recoverable+Purgeable" recoverable = "Recoverable" recoverable_protected_subscription = "Recoverable+ProtectedSubscription" +class JsonWebKeyCurveName(str, Enum): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ -class KeyUsageType(str, Enum): - - digital_signature = "digitalSignature" - non_repudiation = "nonRepudiation" - key_encipherment = "keyEncipherment" - data_encipherment = "dataEncipherment" - key_agreement = "keyAgreement" - key_cert_sign = "keyCertSign" - c_rl_sign = "cRLSign" - encipher_only = "encipherOnly" - decipher_only = "decipherOnly" - - -class ActionType(str, Enum): + p256 = "P-256" #: The NIST P-256 elliptic curve, AKA SECG curve SECP256R1. + p384 = "P-384" #: The NIST P-384 elliptic curve, AKA SECG curve SECP384R1. + p521 = "P-521" #: The NIST P-521 elliptic curve, AKA SECG curve SECP521R1. + p256_k = "P-256K" #: The SECG SECP256K1 elliptic curve. - email_contacts = "EmailContacts" - auto_renew = "AutoRenew" +class JsonWebKeyEncryptionAlgorithm(str, Enum): + """algorithm identifier + """ + rsa_oaep = "RSA-OAEP" + rsa_oaep256 = "RSA-OAEP-256" + rsa1_5 = "RSA1_5" class JsonWebKeyOperation(str, Enum): + """JSON web key operations. For more information, see JsonWebKeyOperation. + """ encrypt = "encrypt" decrypt = "decrypt" @@ -65,30 +54,49 @@ class JsonWebKeyOperation(str, Enum): wrap_key = "wrapKey" unwrap_key = "unwrapKey" +class JsonWebKeySignatureAlgorithm(str, Enum): + """The signing/verification algorithm identifier. For more information on possible algorithm + types, see JsonWebKeySignatureAlgorithm. + """ + + ps256 = "PS256" #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in https://tools.ietf.org/html/rfc7518. + ps384 = "PS384" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in https://tools.ietf.org/html/rfc7518. + ps512 = "PS512" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in https://tools.ietf.org/html/rfc7518. + rs256 = "RS256" #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518. + rs384 = "RS384" #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518. + rs512 = "RS512" #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518. + rsnull = "RSNULL" #: Reserved. + es256 = "ES256" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. + es384 = "ES384" #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518. + es512 = "ES512" #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518. + es256_k = "ES256K" #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518. -class JsonWebKeyEncryptionAlgorithm(str, Enum): - - rsa_oaep = "RSA-OAEP" - rsa_oaep_256 = "RSA-OAEP-256" - rsa1_5 = "RSA1_5" - +class JsonWebKeyType(str, Enum): + """JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web- + algorithms-40. + """ -class JsonWebKeySignatureAlgorithm(str, Enum): + ec = "EC" #: Elliptic Curve. + ec_hsm = "EC-HSM" #: Elliptic Curve with a private key which is not exportable from the HSM. + rsa = "RSA" #: RSA (https://tools.ietf.org/html/rfc3447). + rsa_hsm = "RSA-HSM" #: RSA with a private key which is not exportable from the HSM. + oct = "oct" #: Octet sequence (used to represent symmetric keys). - ps256 = "PS256" #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in https://tools.ietf.org/html/rfc7518 - ps384 = "PS384" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in https://tools.ietf.org/html/rfc7518 - ps512 = "PS512" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in https://tools.ietf.org/html/rfc7518 - rs256 = "RS256" #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 - rs384 = "RS384" #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 - rs512 = "RS512" #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 - rsnull = "RSNULL" #: Reserved - es256 = "ES256" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. - es384 = "ES384" #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 - es512 = "ES512" #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 - es256_k = "ES256K" #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 +class KeyUsageType(str, Enum): + digital_signature = "digitalSignature" + non_repudiation = "nonRepudiation" + key_encipherment = "keyEncipherment" + data_encipherment = "dataEncipherment" + key_agreement = "keyAgreement" + key_cert_sign = "keyCertSign" + c_rl_sign = "cRLSign" + encipher_only = "encipherOnly" + decipher_only = "decipherOnly" class SasTokenType(str, Enum): + """The type of SAS token the SAS definition will create. + """ account = "account" service = "service" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models.py index 7ebc89403a3..2226a4d9051 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models.py @@ -1,36 +1,36 @@ # 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 azure.core.exceptions import HttpResponseError +import msrest.serialization -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v7_0.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +50,10 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = kwargs.get('first_name', None) self.last_name = kwargs.get('last_name', None) @@ -58,22 +61,21 @@ def __init__(self, **kwargs): self.phone = kwargs.get('phone', None) -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +91,10 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -98,11 +103,10 @@ def __init__(self, **kwargs): self.updated = None -class BackupCertificateResult(Model): +class BackupCertificateResult(msrest.serialization.Model): """The backup certificate result, containing the backup blob. - 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 value: The backup blob containing the backed up certificate. :vartype value: bytes @@ -116,16 +120,18 @@ class BackupCertificateResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupCertificateResult, self).__init__(**kwargs) self.value = None -class BackupKeyResult(Model): +class BackupKeyResult(msrest.serialization.Model): """The backup key result, containing the backup blob. - 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 value: The backup blob containing the backed up key. :vartype value: bytes @@ -139,16 +145,18 @@ class BackupKeyResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupKeyResult, self).__init__(**kwargs) self.value = None -class BackupSecretResult(Model): +class BackupSecretResult(msrest.serialization.Model): """The backup secret result, containing the backup blob. - 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 value: The backup blob containing the backed up secret. :vartype value: bytes @@ -162,16 +170,18 @@ class BackupSecretResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupSecretResult, self).__init__(**kwargs) self.value = None -class BackupStorageResult(Model): +class BackupStorageResult(msrest.serialization.Model): """The backup storage result, containing the backup blob. - 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 value: The backup blob containing the backed up storage account. :vartype value: bytes @@ -185,7 +195,10 @@ class BackupStorageResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupStorageResult, self).__init__(**kwargs) self.value = None @@ -193,28 +206,24 @@ def __init__(self, **kwargs): class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -232,16 +241,18 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateAttributes, self).__init__(**kwargs) self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -259,7 +270,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -283,7 +294,10 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -296,16 +310,14 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -315,32 +327,32 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -356,16 +368,19 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) - self.base64_encoded_certificate = kwargs.get('base64_encoded_certificate', None) + self.base64_encoded_certificate = kwargs['base64_encoded_certificate'] self.password = kwargs.get('password', None) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -379,21 +394,22 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.provider = kwargs.get('provider', None) -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str @@ -409,13 +425,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -424,10 +443,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -443,25 +460,26 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) + self.provider = kwargs['provider'] self.credentials = kwargs.get('credentials', None) self.organization_details = kwargs.get('organization_details', None) self.attributes = kwargs.get('attributes', None) -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -473,7 +491,10 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.credentials = kwargs.get('credentials', None) @@ -481,14 +502,14 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -501,7 +522,10 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.attributes = kwargs.get('attributes', None) @@ -509,14 +533,13 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -532,25 +555,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -564,29 +587,30 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) - self.x509_certificates = kwargs.get('x509_certificates', None) + self.x509_certificates = kwargs['x509_certificates'] self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -594,8 +618,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v7_0.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -617,7 +640,10 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = kwargs.get('issuer_parameters', None) @@ -630,13 +656,13 @@ def __init__(self, **kwargs): self.request_id = kwargs.get('request_id', None) -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -648,16 +674,18 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) - self.cancellation_requested = kwargs.get('cancellation_requested', None) + self.cancellation_requested = kwargs['cancellation_requested'] -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str @@ -665,15 +693,12 @@ class CertificatePolicy(Model): :type key_properties: ~azure.keyvault.v7_0.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. :type secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v7_0.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. :type lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes @@ -693,7 +718,10 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = kwargs.get('key_properties', None) @@ -704,13 +732,13 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateRestoreParameters(Model): +class CertificateRestoreParameters(msrest.serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :param certificate_bundle_backup: Required. The backup blob associated - with a certificate bundle. + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. :type certificate_bundle_backup: bytes """ @@ -722,21 +750,22 @@ class CertificateRestoreParameters(Model): 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs.get('certificate_bundle_backup', None) + self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -746,14 +775,17 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -770,18 +802,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = kwargs.get('email_address', None) self.name = kwargs.get('name', None) self.phone = kwargs.get('phone', None) -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -798,18 +832,19 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = kwargs.get('contact_list', None) class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -827,16 +862,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -864,7 +898,10 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None @@ -872,28 +909,25 @@ def __init__(self, **kwargs): class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -911,21 +945,23 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str @@ -941,26 +977,28 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): +class KeyBundle(msrest.serialization.Model): """A KeyBundle consisting of a WebKey plus its attributes. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -975,7 +1013,10 @@ class KeyBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyBundle, self).__init__(**kwargs) self.key = kwargs.get('key', None) self.attributes = kwargs.get('attributes', None) @@ -984,29 +1025,26 @@ def __init__(self, **kwargs): class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. + """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1025,27 +1063,29 @@ class DeletedKeyBundle(KeyBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(Model): +class KeyItem(msrest.serialization.Model): """The key item containing key metadata. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -1060,7 +1100,10 @@ class KeyItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyItem, self).__init__(**kwargs) self.kid = kwargs.get('kid', None) self.attributes = kwargs.get('attributes', None) @@ -1069,29 +1112,26 @@ def __init__(self, **kwargs): class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. + """The deleted key item containing the deleted key metadata and information about deletion. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1110,21 +1150,23 @@ class DeletedKeyItem(KeyItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(Model): +class DeletedKeyListResult(msrest.serialization.Model): """A list of keys that have been deleted in this 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 value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys + :ivar value: A response message containing a list of deleted keys in the vault along with a + link to the next page of deleted keys. :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] :ivar next_link: The URL to get the next set of deleted keys. :vartype next_link: str @@ -1140,36 +1182,36 @@ class DeletedKeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedKeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. +class SasDefinitionBundle(msrest.serialization.Model): + """A SAS definition bundle consists of key vault SAS definition details plus its attributes. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :ivar template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :ivar sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. + :ivar validity_period: The validity period of SAS tokens created according to the SAS + definition. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1193,7 +1235,10 @@ class SasDefinitionBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionBundle, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -1205,38 +1250,34 @@ def __init__(self, **kwargs): class DeletedSasDefinitionBundle(SasDefinitionBundle): - """A deleted SAS definition bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. + """A deleted SAS definition bundle consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :ivar template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :ivar sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. + :ivar validity_period: The validity period of SAS tokens created according to the SAS + definition. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + SAS definition. :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the SAS definition is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the SAS definition was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1264,18 +1305,20 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSasDefinitionBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class SasDefinitionItem(Model): +class SasDefinitionItem(msrest.serialization.Model): """The SAS definition item containing storage SAS definition metadata. - 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 storage SAS identifier. :vartype id: str @@ -1283,7 +1326,7 @@ class SasDefinitionItem(Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1301,7 +1344,10 @@ class SasDefinitionItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionItem, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -1310,11 +1356,9 @@ def __init__(self, **kwargs): class DeletedSasDefinitionItem(SasDefinitionItem): - """The deleted SAS definition item containing metadata about the deleted SAS - definition. + """The deleted SAS definition item containing metadata about the deleted SAS definition. - 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 storage SAS identifier. :vartype id: str @@ -1322,16 +1366,15 @@ class DeletedSasDefinitionItem(SasDefinitionItem): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + SAS definition. :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the SAS definition is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the SAS definition was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1353,22 +1396,23 @@ class DeletedSasDefinitionItem(SasDefinitionItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSasDefinitionItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedSasDefinitionListResult(Model): +class DeletedSasDefinitionListResult(msrest.serialization.Model): """The deleted SAS definition list result. - 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 value: A response message containing a list of the deleted SAS - definitions in the vault along with a link to the next page of deleted sas - definitions + :ivar value: A response message containing a list of the deleted SAS definitions in the vault + along with a link to the next page of deleted sas definitions. :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :ivar next_link: The URL to get the next set of deleted SAS definitions. :vartype next_link: str @@ -1384,17 +1428,19 @@ class DeletedSasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(Model): +class SecretBundle(msrest.serialization.Model): """A secret consisting of a value, id and its attributes. - 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. :param value: The secret value. :type value: str @@ -1404,13 +1450,13 @@ class SecretBundle(Model): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool """ @@ -1429,7 +1475,10 @@ class SecretBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretBundle, self).__init__(**kwargs) self.value = kwargs.get('value', None) self.id = kwargs.get('id', None) @@ -1441,11 +1490,9 @@ def __init__(self, **kwargs): class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. + """A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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. :param value: The secret value. :type value: str @@ -1455,22 +1502,21 @@ class DeletedSecretBundle(SecretBundle): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1493,29 +1539,31 @@ class DeletedSecretBundle(SecretBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class SecretItem(Model): +class SecretItem(msrest.serialization.Model): """The secret item containing secret metadata. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool """ @@ -1531,7 +1579,10 @@ class SecretItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.attributes = kwargs.get('attributes', None) @@ -1543,28 +1594,26 @@ def __init__(self, **kwargs): class DeletedSecretItem(SecretItem): """The deleted secret item containing metadata about the deleted secret. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1584,21 +1633,23 @@ class DeletedSecretItem(SecretItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedSecretListResult(Model): +class DeletedSecretListResult(msrest.serialization.Model): """The deleted secret list result. - 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 value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets + :ivar value: A response message containing a list of the deleted secrets in the vault along + with a link to the next page of deleted secrets. :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] :ivar next_link: The URL to get the next set of deleted secrets. :vartype next_link: str @@ -1614,17 +1665,19 @@ class DeletedSecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedSecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class StorageAccountItem(Model): +class StorageAccountItem(msrest.serialization.Model): """The storage account item containing storage account metadata. - 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: Storage identifier. :vartype id: str @@ -1632,7 +1685,7 @@ class StorageAccountItem(Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1650,7 +1703,10 @@ class StorageAccountItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountItem, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -1659,11 +1715,9 @@ def __init__(self, **kwargs): class DeletedStorageAccountItem(StorageAccountItem): - """The deleted storage account item containing metadata about the deleted - storage account. + """The deleted storage account item containing metadata about the deleted storage account. - 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: Storage identifier. :vartype id: str @@ -1671,16 +1725,16 @@ class DeletedStorageAccountItem(StorageAccountItem): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + storage account. :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the storage account is scheduled to be purged, in + UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the storage account was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1702,19 +1756,20 @@ class DeletedStorageAccountItem(StorageAccountItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedStorageAccountItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. +class StorageBundle(msrest.serialization.Model): + """A Storage account bundle consists of key vault storage account details plus its attributes. - 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 storage account id. :vartype id: str @@ -1722,15 +1777,13 @@ class StorageBundle(Model): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1754,7 +1807,10 @@ class StorageBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageBundle, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -1766,11 +1822,9 @@ def __init__(self, **kwargs): class DeletedStorageBundle(StorageBundle): - """A deleted storage account bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. + """A deleted storage account bundle consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 storage account id. :vartype id: str @@ -1778,24 +1832,22 @@ class DeletedStorageBundle(StorageBundle): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + storage account. :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the storage account is scheduled to be purged, in + UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the storage account was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1823,24 +1875,24 @@ class DeletedStorageBundle(StorageBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedStorageBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedStorageListResult(Model): +class DeletedStorageListResult(msrest.serialization.Model): """The deleted storage account list result. - 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 value: A response message containing a list of the deleted storage - accounts in the vault along with a link to the next page of deleted - storage accounts - :vartype value: - list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar value: A response message containing a list of the deleted storage accounts in the vault + along with a link to the next page of deleted storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :ivar next_link: The URL to get the next set of deleted storage accounts. :vartype next_link: str """ @@ -1855,23 +1907,25 @@ class DeletedStorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedStorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class Error(Model): +class Error(msrest.serialization.Model): """The key vault server error. - 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 code: The error code. :vartype code: str :ivar message: The error message. :vartype message: str - :ivar inner_error: + :ivar inner_error: The key vault server error. :vartype inner_error: ~azure.keyvault.v7_0.models.Error """ @@ -1887,25 +1941,27 @@ class Error(Model): 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(Model): +class IssuerAttributes(msrest.serialization.Model): """The attributes of an issuer managed by the Key Vault service. - 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. :param enabled: Determines whether the issuer is enabled. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -1919,18 +1975,20 @@ class IssuerAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None self.updated = None -class IssuerBundle(Model): +class IssuerBundle(msrest.serialization.Model): """The issuer for Key Vault certificate. - 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: Identifier for the issuer object. :vartype id: str @@ -1938,10 +1996,8 @@ class IssuerBundle(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -1958,7 +2014,10 @@ class IssuerBundle(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerBundle, self).__init__(**kwargs) self.id = None self.provider = kwargs.get('provider', None) @@ -1967,7 +2026,7 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class IssuerCredentials(Model): +class IssuerCredentials(msrest.serialization.Model): """The credentials to be used for the certificate issuer. :param account_id: The user name/account name/account id. @@ -1981,23 +2040,26 @@ class IssuerCredentials(Model): 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerCredentials, self).__init__(**kwargs) self.account_id = kwargs.get('account_id', None) self.password = kwargs.get('password', None) -class IssuerParameters(Model): +class IssuerParameters(msrest.serialization.Model): """Parameters for the issuer of the X509 component of a certificate. - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. :type name: str - :param certificate_type: Type of certificate to be requested from the - issuer provider. + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. :type certificate_type: str - :param certificate_transparency: Indicates if the certificates generated - under this policy should be published to certificate transparency logs. + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. :type certificate_transparency: bool """ @@ -2007,21 +2069,23 @@ class IssuerParameters(Model): 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(IssuerParameters, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.certificate_type = kwargs.get('certificate_type', None) self.certificate_transparency = kwargs.get('certificate_transparency', None) -class JsonWebKey(Model): +class JsonWebKey(msrest.serialization.Model): """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :param kid: Key identifier. :type kid: str - :param kty: JsonWebKey Key Type (kty), as defined in - https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param kty: JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf- + jose-json-web-algorithms-40. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :param key_ops: :type key_ops: list[str] @@ -2045,9 +2109,8 @@ class JsonWebKey(Model): :type k: bytes :param t: HSM Token, used with 'Bring Your Own Key'. :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :param x: X component of an EC public key. :type x: bytes @@ -2074,7 +2137,10 @@ class JsonWebKey(Model): 'y': {'key': 'y', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(JsonWebKey, self).__init__(**kwargs) self.kid = kwargs.get('kid', None) self.kty = kwargs.get('kty', None) @@ -2097,27 +2163,24 @@ def __init__(self, **kwargs): class KeyAttributes(Attributes): """The attributes of a key managed by the key vault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for keys in the + current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged + user; otherwise, only the system can purge the key, at the end of the retention interval. + Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2135,38 +2198,37 @@ class KeyAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyAttributes, self).__init__(**kwargs) self.recovery_level = None -class KeyCreateParameters(Model): +class KeyCreateParameters(msrest.serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' + :param kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible + values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True, 'min_length': 1}, + 'kty': {'required': True}, } _attribute_map = { @@ -2178,9 +2240,12 @@ class KeyCreateParameters(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kwargs.get('kty', None) + self.kty = kwargs['kty'] self.key_size = kwargs.get('key_size', None) self.key_ops = kwargs.get('key_ops', None) self.key_attributes = kwargs.get('key_attributes', None) @@ -2188,18 +2253,18 @@ def __init__(self, **kwargs): self.curve = kwargs.get('curve', None) -class KeyImportParameters(Model): +class KeyImportParameters(msrest.serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool - :param key: Required. The Json web key + :param key: Required. The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2214,22 +2279,24 @@ class KeyImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyImportParameters, self).__init__(**kwargs) self.hsm = kwargs.get('hsm', None) - self.key = kwargs.get('key', None) + self.key = kwargs['key'] self.key_attributes = kwargs.get('key_attributes', None) self.tags = kwargs.get('tags', None) -class KeyListResult(Model): +class KeyListResult(msrest.serialization.Model): """The key list result. - 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 value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. + :ivar value: A response message containing a list of keys in the key vault along with a link to + the next page of keys. :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] :ivar next_link: The URL to get the next set of keys. :vartype next_link: str @@ -2245,19 +2312,21 @@ class KeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(Model): +class KeyOperationResult(msrest.serialization.Model): """The key operation result. - 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 kid: Key identifier + :ivar kid: Key identifier. :vartype kid: str :ivar result: :vartype result: bytes @@ -2273,27 +2342,29 @@ class KeyOperationResult(Model): 'result': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyOperationResult, self).__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(Model): +class KeyOperationsParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", "RSA- + OAEP-256", "RSA1_5". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -2302,29 +2373,29 @@ class KeyOperationsParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) + self.algorithm = kwargs['algorithm'] + self.value = kwargs['value'] -class KeyProperties(Model): +class KeyProperties(msrest.serialization.Model): """Properties of the key pair backing a certificate. :param exportable: Indicates if the private key can be exported. :type exportable: bool - :param key_type: The type of key pair to be used for the certificate. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. :type reuse_key: bool - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ @@ -2336,7 +2407,10 @@ class KeyProperties(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyProperties, self).__init__(**kwargs) self.exportable = kwargs.get('exportable', None) self.key_type = kwargs.get('key_type', None) @@ -2345,13 +2419,12 @@ def __init__(self, **kwargs): self.curve = kwargs.get('curve', None) -class KeyRestoreParameters(Model): +class KeyRestoreParameters(msrest.serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. + :param key_bundle_backup: Required. The backup blob associated with a key bundle. :type key_bundle_backup: bytes """ @@ -2363,29 +2436,30 @@ class KeyRestoreParameters(Model): 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs.get('key_bundle_backup', None) + self.key_bundle_backup = kwargs['key_bundle_backup'] -class KeySignParameters(Model): +class KeySignParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm identifier. For more information + on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", + "ES256K". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -2394,22 +2468,24 @@ class KeySignParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) + self.algorithm = kwargs['algorithm'] + self.value = kwargs['value'] -class KeyUpdateParameters(Model): +class KeyUpdateParameters(msrest.serialization.Model): """The key update parameters. - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2419,20 +2495,22 @@ class KeyUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyUpdateParameters, self).__init__(**kwargs) self.key_ops = kwargs.get('key_ops', None) self.key_attributes = kwargs.get('key_attributes', None) self.tags = kwargs.get('tags', None) -class KeyVaultError(Model): +class KeyVaultError(msrest.serialization.Model): """The key vault error exception. - 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 error: + :ivar error: The key vault server error. :vartype error: ~azure.keyvault.v7_0.models.Error """ @@ -2444,38 +2522,23 @@ class KeyVaultError(Model): 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVaultError, self).__init__(**kwargs) self.error = None -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): +class KeyVerifyParameters(msrest.serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", "ES256K". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param digest: Required. The digest used for signing. :type digest: bytes :param signature: Required. The signature to be verified. @@ -2483,7 +2546,7 @@ class KeyVerifyParameters(Model): """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'digest': {'required': True}, 'signature': {'required': True}, } @@ -2494,18 +2557,20 @@ class KeyVerifyParameters(Model): 'signature': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.digest = kwargs.get('digest', None) - self.signature = kwargs.get('signature', None) + self.algorithm = kwargs['algorithm'] + self.digest = kwargs['digest'] + self.signature = kwargs['signature'] -class KeyVerifyResult(Model): +class KeyVerifyResult(msrest.serialization.Model): """The key verify result. - 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 value: True if the signature is verified, otherwise false. :vartype value: bool @@ -2519,14 +2584,16 @@ class KeyVerifyResult(Model): 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(KeyVerifyResult, self).__init__(**kwargs) self.value = None -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :param trigger: The condition that will execute the action. :type trigger: ~azure.keyvault.v7_0.models.Trigger @@ -2539,20 +2606,22 @@ class LifetimeAction(Model): 'action': {'key': 'action', 'type': 'Action'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(LifetimeAction, self).__init__(**kwargs) self.trigger = kwargs.get('trigger', None) self.action = kwargs.get('action', None) -class OrganizationDetails(Model): +class OrganizationDetails(msrest.serialization.Model): """Details of the organization of the certificate issuer. :param id: Id of the organization. :type id: str :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v7_0.models.AdministratorDetails] + :type admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] """ _attribute_map = { @@ -2560,20 +2629,21 @@ class OrganizationDetails(Model): 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(OrganizationDetails, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.admin_details = kwargs.get('admin_details', None) -class PendingCertificateSigningRequestResult(Model): +class PendingCertificateSigningRequestResult(msrest.serialization.Model): """The pending certificate signing request result. - 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 value: The pending certificate signing request as Base64 encoded - string. + :ivar value: The pending certificate signing request as Base64 encoded string. :vartype value: str """ @@ -2585,32 +2655,31 @@ class PendingCertificateSigningRequestResult(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None -class SasDefinitionAttributes(Model): +class SasDefinitionAttributes(msrest.serialization.Model): """The SAS definition management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for SAS definitions in the current vault. If it contains - 'Purgeable' the SAS definition can be permanently deleted by a privileged - user; otherwise, only the system can purge the SAS definition, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for SAS + definitions in the current vault. If it contains 'Purgeable' the SAS definition can be + permanently deleted by a privileged user; otherwise, only the system can purge the SAS + definition, at the end of the retention interval. Possible values include: "Purgeable", + "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2626,7 +2695,10 @@ class SasDefinitionAttributes(Model): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None @@ -2634,25 +2706,23 @@ def __init__(self, **kwargs): self.recovery_level = None -class SasDefinitionCreateParameters(Model): +class SasDefinitionCreateParameters(msrest.serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :param template_uri: Required. The SAS definition token template signed - with an arbitrary key. Tokens created according to the SAS definition - will have the same properties as the template. + :param template_uri: Required. The SAS definition token template signed with an arbitrary key. + Tokens created according to the SAS definition will have the same properties as the template. :type template_uri: str - :param sas_type: Required. The type of SAS token the SAS definition will - create. Possible values include: 'account', 'service' + :param sas_type: Required. The type of SAS token the SAS definition will create. Possible + values include: "account", "service". :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: Required. The validity period of SAS tokens - created according to the SAS definition. + :param validity_period: Required. The validity period of SAS tokens created according to the + SAS definition. :type validity_period: str :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2670,23 +2740,25 @@ class SasDefinitionCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.template_uri = kwargs.get('template_uri', None) - self.sas_type = kwargs.get('sas_type', None) - self.validity_period = kwargs.get('validity_period', None) + self.template_uri = kwargs['template_uri'] + self.sas_type = kwargs['sas_type'] + self.validity_period = kwargs['validity_period'] self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) self.tags = kwargs.get('tags', None) -class SasDefinitionListResult(Model): +class SasDefinitionListResult(msrest.serialization.Model): """The storage account SAS definition list result. - 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 value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. + :ivar value: A response message containing a list of SAS definitions along with a link to the + next page of SAS definitions. :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] :ivar next_link: The URL to get the next set of SAS definitions. :vartype next_link: str @@ -2702,29 +2774,30 @@ class SasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(Model): +class SasDefinitionUpdateParameters(msrest.serialization.Model): """The SAS definition update parameters. - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :param sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. :type validity_period: str :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2736,7 +2809,10 @@ class SasDefinitionUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SasDefinitionUpdateParameters, self).__init__(**kwargs) self.template_uri = kwargs.get('template_uri', None) self.sas_type = kwargs.get('sas_type', None) @@ -2748,27 +2824,24 @@ def __init__(self, **kwargs): class SecretAttributes(Attributes): """The secret management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for secrets in + the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a + privileged user; otherwise, only the system can purge the secret, at the end of the retention + interval. Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2786,19 +2859,21 @@ class SecretAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretAttributes, self).__init__(**kwargs) self.recovery_level = None -class SecretListResult(Model): +class SecretListResult(msrest.serialization.Model): """The secret list result. - 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 value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. + :ivar value: A response message containing a list of secrets in the key vault along with a link + to the next page of secrets. :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] :ivar next_link: The URL to get the next set of secrets. :vartype next_link: str @@ -2814,13 +2889,16 @@ class SecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2831,18 +2909,20 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) -class SecretRestoreParameters(Model): +class SecretRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. + :param secret_bundle_backup: Required. The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes """ @@ -2854,19 +2934,22 @@ class SecretRestoreParameters(Model): 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs.get('secret_bundle_backup', None) + self.secret_bundle_backup = kwargs['secret_bundle_backup'] -class SecretSetParameters(Model): +class SecretSetParameters(msrest.serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. :param value: Required. The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str @@ -2885,22 +2968,25 @@ class SecretSetParameters(Model): 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretSetParameters, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + self.value = kwargs['value'] self.tags = kwargs.get('tags', None) self.content_type = kwargs.get('content_type', None) self.secret_attributes = kwargs.get('secret_attributes', None) -class SecretUpdateParameters(Model): +class SecretUpdateParameters(msrest.serialization.Model): """The secret update parameters. :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2910,34 +2996,33 @@ class SecretUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretUpdateParameters, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) self.secret_attributes = kwargs.get('secret_attributes', None) self.tags = kwargs.get('tags', None) -class StorageAccountAttributes(Model): +class StorageAccountAttributes(msrest.serialization.Model): """The storage account management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for storage accounts in the current vault. If it contains - 'Purgeable' the storage account can be permanently deleted by a privileged - user; otherwise, only the system can purge the storage account, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for storage + accounts in the current vault. If it contains 'Purgeable' the storage account can be + permanently deleted by a privileged user; otherwise, only the system can purge the storage + account, at the end of the retention interval. Possible values include: "Purgeable", + "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2953,7 +3038,10 @@ class StorageAccountAttributes(Model): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountAttributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.created = None @@ -2961,7 +3049,7 @@ def __init__(self, **kwargs): self.recovery_level = None -class StorageAccountCreateParameters(Model): +class StorageAccountCreateParameters(msrest.serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. @@ -2970,16 +3058,14 @@ class StorageAccountCreateParameters(Model): :type resource_id: str :param active_key_name: Required. Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. + :param auto_regenerate_key: Required. whether keyvault should manage the storage account for + the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2998,17 +3084,20 @@ class StorageAccountCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.active_key_name = kwargs.get('active_key_name', None) - self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) + self.resource_id = kwargs['resource_id'] + self.active_key_name = kwargs['active_key_name'] + self.auto_regenerate_key = kwargs['auto_regenerate_key'] self.regeneration_period = kwargs.get('regeneration_period', None) self.storage_account_attributes = kwargs.get('storage_account_attributes', None) self.tags = kwargs.get('tags', None) -class StorageAccountRegenerteKeyParameters(Model): +class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. @@ -3025,26 +3114,26 @@ class StorageAccountRegenerteKeyParameters(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) + self.key_name = kwargs['key_name'] -class StorageAccountUpdateParameters(Model): +class StorageAccountUpdateParameters(msrest.serialization.Model): """The storage account update parameters. :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -3056,7 +3145,10 @@ class StorageAccountUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.active_key_name = kwargs.get('active_key_name', None) self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) @@ -3065,14 +3157,13 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class StorageListResult(Model): +class StorageListResult(msrest.serialization.Model): """The storage accounts list result. - 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 value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. + :ivar value: A response message containing a list of storage accounts in the key vault along + with a link to the next page of storage accounts. :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] :ivar next_link: The URL to get the next set of storage accounts. :vartype next_link: str @@ -3088,19 +3179,21 @@ class StorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class StorageRestoreParameters(Model): +class StorageRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param storage_bundle_backup: Required. The backup blob associated with a - storage account. + :param storage_bundle_backup: Required. The backup blob associated with a storage account. :type storage_bundle_backup: bytes """ @@ -3112,12 +3205,15 @@ class StorageRestoreParameters(Model): 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = kwargs.get('storage_bundle_backup', None) + self.storage_bundle_backup = kwargs['storage_bundle_backup'] -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -3134,23 +3230,25 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = kwargs.get('emails', None) self.dns_names = kwargs.get('dns_names', None) self.upns = kwargs.get('upns', None) -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -3163,27 +3261,27 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = kwargs.get('lifetime_percentage', None) self.days_before_expiry = kwargs.get('days_before_expiry', None) -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v7_0.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames :param key_usage: List of key usages. :type key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -3199,7 +3297,10 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.ekus = kwargs.get('ekus', None) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models_py3.py index dffe1b2a4ce..2e6ecec9622 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/models/_models_py3.py @@ -1,36 +1,43 @@ # 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 datetime +from typing import Dict, List, Optional, Union + from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._key_vault_client_enums import * -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v7_0.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, *, action_type=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "ActionType"]] = None, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +57,15 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, first_name: str=None, last_name: str=None, email_address: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = first_name self.last_name = last_name @@ -58,22 +73,21 @@ def __init__(self, *, first_name: str=None, last_name: str=None, email_address: self.phone = phone -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +103,14 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -98,11 +119,10 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.updated = None -class BackupCertificateResult(Model): +class BackupCertificateResult(msrest.serialization.Model): """The backup certificate result, containing the backup blob. - 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 value: The backup blob containing the backed up certificate. :vartype value: bytes @@ -116,16 +136,18 @@ class BackupCertificateResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupCertificateResult, self).__init__(**kwargs) self.value = None -class BackupKeyResult(Model): +class BackupKeyResult(msrest.serialization.Model): """The backup key result, containing the backup blob. - 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 value: The backup blob containing the backed up key. :vartype value: bytes @@ -139,16 +161,18 @@ class BackupKeyResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupKeyResult, self).__init__(**kwargs) self.value = None -class BackupSecretResult(Model): +class BackupSecretResult(msrest.serialization.Model): """The backup secret result, containing the backup blob. - 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 value: The backup blob containing the backed up secret. :vartype value: bytes @@ -162,16 +186,18 @@ class BackupSecretResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupSecretResult, self).__init__(**kwargs) self.value = None -class BackupStorageResult(Model): +class BackupStorageResult(msrest.serialization.Model): """The backup storage result, containing the backup blob. - 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 value: The backup blob containing the backed up storage account. :vartype value: bytes @@ -185,7 +211,10 @@ class BackupStorageResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupStorageResult, self).__init__(**kwargs) self.value = None @@ -193,28 +222,24 @@ def __init__(self, **kwargs) -> None: class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -232,16 +257,22 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -259,7 +290,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -283,7 +314,15 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -296,16 +335,14 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No self.tags = tags -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -315,32 +352,36 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -356,7 +397,16 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, base64_encoded_certificate: str, password: str=None, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password @@ -365,7 +415,7 @@ def __init__(self, *, base64_encoded_certificate: str, password: str=None, certi self.tags = tags -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -379,21 +429,25 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + provider: Optional[str] = None, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str @@ -409,13 +463,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -424,10 +481,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -443,7 +498,15 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: str, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -451,17 +514,15 @@ def __init__(self, *, provider: str, credentials=None, organization_details=None self.attributes = attributes -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -473,7 +534,15 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -481,14 +550,14 @@ def __init__(self, *, provider: str=None, credentials=None, organization_details self.attributes = attributes -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -501,7 +570,15 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = id self.attributes = attributes @@ -509,14 +586,13 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -532,25 +608,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -564,29 +640,34 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, x509_certificates, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + x509_certificates: List[bytearray], + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -594,8 +675,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v7_0.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -617,7 +697,19 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_requested: bool=None, status: str=None, status_details: str=None, error=None, target: str=None, request_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + issuer_parameters: Optional["IssuerParameters"] = None, + csr: Optional[bytearray] = None, + cancellation_requested: Optional[bool] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + error: Optional["Error"] = None, + target: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters @@ -630,13 +722,13 @@ def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_ self.request_id = request_id -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -648,16 +740,20 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, *, cancellation_requested: bool, **kwargs) -> None: + def __init__( + self, + *, + cancellation_requested: bool, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str @@ -665,15 +761,12 @@ class CertificatePolicy(Model): :type key_properties: ~azure.keyvault.v7_0.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. :type secret_properties: ~azure.keyvault.v7_0.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_0.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v7_0.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. :type lifetime_actions: list[~azure.keyvault.v7_0.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_0.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes @@ -693,7 +786,17 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, *, key_properties=None, secret_properties=None, x509_certificate_properties=None, lifetime_actions=None, issuer_parameters=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + key_properties: Optional["KeyProperties"] = None, + secret_properties: Optional["SecretProperties"] = None, + x509_certificate_properties: Optional["X509CertificateProperties"] = None, + lifetime_actions: Optional[List["LifetimeAction"]] = None, + issuer_parameters: Optional["IssuerParameters"] = None, + attributes: Optional["CertificateAttributes"] = None, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = key_properties @@ -704,13 +807,13 @@ def __init__(self, *, key_properties=None, secret_properties=None, x509_certific self.attributes = attributes -class CertificateRestoreParameters(Model): +class CertificateRestoreParameters(msrest.serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :param certificate_bundle_backup: Required. The backup blob associated - with a certificate bundle. + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. :type certificate_bundle_backup: bytes """ @@ -722,21 +825,24 @@ class CertificateRestoreParameters(Model): 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, certificate_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + certificate_bundle_backup: bytes, + **kwargs + ): super(CertificateRestoreParameters, self).__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -746,14 +852,21 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -770,18 +883,24 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email_address: str=None, name: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + email_address: Optional[str] = None, + name: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -798,18 +917,21 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, *, contact_list=None, **kwargs) -> None: + def __init__( + self, + *, + contact_list: Optional[List["Contact"]] = None, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = contact_list class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -827,16 +949,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -864,7 +985,16 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None @@ -872,28 +1002,25 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -911,21 +1038,29 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str @@ -941,26 +1076,28 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): +class KeyBundle(msrest.serialization.Model): """A KeyBundle consisting of a WebKey plus its attributes. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -975,7 +1112,14 @@ class KeyBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, key=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional["JsonWebKey"] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyBundle, self).__init__(**kwargs) self.key = key self.attributes = attributes @@ -984,29 +1128,26 @@ def __init__(self, *, key=None, attributes=None, tags=None, **kwargs) -> None: class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. + """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info. - 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. :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1025,27 +1166,34 @@ class DeletedKeyBundle(KeyBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, key=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + key: Optional["JsonWebKey"] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class KeyItem(Model): +class KeyItem(msrest.serialization.Model): """The key item containing key metadata. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool """ @@ -1060,7 +1208,14 @@ class KeyItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyItem, self).__init__(**kwargs) self.kid = kid self.attributes = attributes @@ -1069,29 +1224,26 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, **kwargs) -> No class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. + """The deleted key item containing the deleted key metadata and information about deletion. - 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. :param kid: Key identifier. :type kid: str :param attributes: The key management attributes. :type attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. + :ivar managed: True if the key's lifetime is managed by key vault. If this is a key backing a + certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + key. :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the key is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the key was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1110,21 +1262,28 @@ class DeletedKeyItem(KeyItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedKeyListResult(Model): +class DeletedKeyListResult(msrest.serialization.Model): """A list of keys that have been deleted in this 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 value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys + :ivar value: A response message containing a list of deleted keys in the vault along with a + link to the next page of deleted keys. :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] :ivar next_link: The URL to get the next set of deleted keys. :vartype next_link: str @@ -1140,36 +1299,36 @@ class DeletedKeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedKeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. +class SasDefinitionBundle(msrest.serialization.Model): + """A SAS definition bundle consists of key vault SAS definition details plus its attributes. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :ivar template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :ivar sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. + :ivar validity_period: The validity period of SAS tokens created according to the SAS + definition. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1193,7 +1352,10 @@ class SasDefinitionBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionBundle, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -1205,38 +1367,34 @@ def __init__(self, **kwargs) -> None: class DeletedSasDefinitionBundle(SasDefinitionBundle): - """A deleted SAS definition bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. + """A deleted SAS definition bundle consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 SAS definition id. :vartype id: str :ivar secret_id: Storage account SAS definition secret id. :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :ivar template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :ivar sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :vartype sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. + :ivar validity_period: The validity period of SAS tokens created according to the SAS + definition. :vartype validity_period: str :ivar attributes: The SAS definition attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + SAS definition. :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the SAS definition is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the SAS definition was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1264,18 +1422,22 @@ class DeletedSasDefinitionBundle(SasDefinitionBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSasDefinitionBundle, self).__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SasDefinitionItem(Model): +class SasDefinitionItem(msrest.serialization.Model): """The SAS definition item containing storage SAS definition metadata. - 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 storage SAS identifier. :vartype id: str @@ -1283,7 +1445,7 @@ class SasDefinitionItem(Model): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1301,7 +1463,10 @@ class SasDefinitionItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionItem, self).__init__(**kwargs) self.id = None self.secret_id = None @@ -1310,11 +1475,9 @@ def __init__(self, **kwargs) -> None: class DeletedSasDefinitionItem(SasDefinitionItem): - """The deleted SAS definition item containing metadata about the deleted SAS - definition. + """The deleted SAS definition item containing metadata about the deleted SAS definition. - 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 storage SAS identifier. :vartype id: str @@ -1322,16 +1485,15 @@ class DeletedSasDefinitionItem(SasDefinitionItem): :vartype secret_id: str :ivar attributes: The SAS definition management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + SAS definition. :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the SAS definition is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the SAS definition was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1353,22 +1515,25 @@ class DeletedSasDefinitionItem(SasDefinitionItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSasDefinitionItem, self).__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSasDefinitionListResult(Model): +class DeletedSasDefinitionListResult(msrest.serialization.Model): """The deleted SAS definition list result. - 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 value: A response message containing a list of the deleted SAS - definitions in the vault along with a link to the next page of deleted sas - definitions + :ivar value: A response message containing a list of the deleted SAS definitions in the vault + along with a link to the next page of deleted sas definitions. :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :ivar next_link: The URL to get the next set of deleted SAS definitions. :vartype next_link: str @@ -1384,17 +1549,19 @@ class DeletedSasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedSasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretBundle(Model): +class SecretBundle(msrest.serialization.Model): """A secret consisting of a value, id and its attributes. - 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. :param value: The secret value. :type value: str @@ -1404,13 +1571,13 @@ class SecretBundle(Model): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool """ @@ -1429,7 +1596,16 @@ class SecretBundle(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + id: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SecretBundle, self).__init__(**kwargs) self.value = value self.id = id @@ -1441,11 +1617,9 @@ def __init__(self, *, value: str=None, id: str=None, content_type: str=None, att class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. + """A Deleted Secret consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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. :param value: The secret value. :type value: str @@ -1455,22 +1629,21 @@ class DeletedSecretBundle(SecretBundle): :type content_type: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. + :ivar kid: If this is a secret backing a KV certificate, then this field specifies the + corresponding key backing the KV certificate. :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a secret + backing a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1493,29 +1666,38 @@ class DeletedSecretBundle(SecretBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + value: Optional[str] = None, + id: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class SecretItem(Model): +class SecretItem(msrest.serialization.Model): """The secret item containing secret metadata. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool """ @@ -1531,7 +1713,15 @@ class SecretItem(Model): 'managed': {'key': 'managed', 'type': 'bool'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + **kwargs + ): super(SecretItem, self).__init__(**kwargs) self.id = id self.attributes = attributes @@ -1543,28 +1733,26 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st class DeletedSecretItem(SecretItem): """The deleted secret item containing metadata about the deleted secret. - 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. :param id: Secret identifier. :type id: str :param attributes: The secret management attributes. :type attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. + :ivar managed: True if the secret's lifetime is managed by key vault. If this is a key backing + a certificate, then managed will be true. :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + secret. :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the secret is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the secret was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1584,21 +1772,29 @@ class DeletedSecretItem(SecretItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedSecretListResult(Model): +class DeletedSecretListResult(msrest.serialization.Model): """The deleted secret list result. - 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 value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets + :ivar value: A response message containing a list of the deleted secrets in the vault along + with a link to the next page of deleted secrets. :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] :ivar next_link: The URL to get the next set of deleted secrets. :vartype next_link: str @@ -1614,17 +1810,19 @@ class DeletedSecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedSecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class StorageAccountItem(Model): +class StorageAccountItem(msrest.serialization.Model): """The storage account item containing storage account metadata. - 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: Storage identifier. :vartype id: str @@ -1632,7 +1830,7 @@ class StorageAccountItem(Model): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1650,7 +1848,10 @@ class StorageAccountItem(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageAccountItem, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -1659,11 +1860,9 @@ def __init__(self, **kwargs) -> None: class DeletedStorageAccountItem(StorageAccountItem): - """The deleted storage account item containing metadata about the deleted - storage account. + """The deleted storage account item containing metadata about the deleted storage account. - 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: Storage identifier. :vartype id: str @@ -1671,16 +1870,16 @@ class DeletedStorageAccountItem(StorageAccountItem): :vartype resource_id: str :ivar attributes: The storage account management attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + storage account. :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the storage account is scheduled to be purged, in + UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the storage account was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1702,19 +1901,22 @@ class DeletedStorageAccountItem(StorageAccountItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedStorageAccountItem, self).__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. +class StorageBundle(msrest.serialization.Model): + """A Storage account bundle consists of key vault storage account details plus its attributes. - 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 storage account id. :vartype id: str @@ -1722,15 +1924,13 @@ class StorageBundle(Model): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] """ @@ -1754,7 +1954,10 @@ class StorageBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageBundle, self).__init__(**kwargs) self.id = None self.resource_id = None @@ -1766,11 +1969,9 @@ def __init__(self, **kwargs) -> None: class DeletedStorageBundle(StorageBundle): - """A deleted storage account bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. + """A deleted storage account bundle consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 storage account id. :vartype id: str @@ -1778,24 +1979,22 @@ class DeletedStorageBundle(StorageBundle): :vartype resource_id: str :ivar active_key_name: The current active storage account key name. :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :ivar auto_regenerate_key: whether keyvault should manage the storage account for the user. :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. + :ivar regeneration_period: The key regeneration time duration specified in ISO-8601 format. :vartype regeneration_period: str :ivar attributes: The storage account attributes. :vartype attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs + :ivar tags: A set of tags. Application specific metadata in the form of key-value pairs. :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + storage account. :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the storage account is scheduled to be purged, in + UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the storage account was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -1823,24 +2022,26 @@ class DeletedStorageBundle(StorageBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedStorageBundle, self).__init__(**kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedStorageListResult(Model): +class DeletedStorageListResult(msrest.serialization.Model): """The deleted storage account list result. - 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 value: A response message containing a list of the deleted storage - accounts in the vault along with a link to the next page of deleted - storage accounts - :vartype value: - list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar value: A response message containing a list of the deleted storage accounts in the vault + along with a link to the next page of deleted storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :ivar next_link: The URL to get the next set of deleted storage accounts. :vartype next_link: str """ @@ -1855,23 +2056,25 @@ class DeletedStorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedStorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class Error(Model): +class Error(msrest.serialization.Model): """The key vault server error. - 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 code: The error code. :vartype code: str :ivar message: The error message. :vartype message: str - :ivar inner_error: + :ivar inner_error: The key vault server error. :vartype inner_error: ~azure.keyvault.v7_0.models.Error """ @@ -1887,25 +2090,27 @@ class Error(Model): 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(Error, self).__init__(**kwargs) self.code = None self.message = None self.inner_error = None -class IssuerAttributes(Model): +class IssuerAttributes(msrest.serialization.Model): """The attributes of an issuer managed by the Key Vault service. - 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. :param enabled: Determines whether the issuer is enabled. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -1919,18 +2124,22 @@ class IssuerAttributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(IssuerAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None self.updated = None -class IssuerBundle(Model): +class IssuerBundle(msrest.serialization.Model): """The issuer for Key Vault certificate. - 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: Identifier for the issuer object. :vartype id: str @@ -1938,10 +2147,8 @@ class IssuerBundle(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes """ @@ -1958,7 +2165,15 @@ class IssuerBundle(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(IssuerBundle, self).__init__(**kwargs) self.id = None self.provider = provider @@ -1967,7 +2182,7 @@ def __init__(self, *, provider: str=None, credentials=None, organization_details self.attributes = attributes -class IssuerCredentials(Model): +class IssuerCredentials(msrest.serialization.Model): """The credentials to be used for the certificate issuer. :param account_id: The user name/account name/account id. @@ -1981,23 +2196,29 @@ class IssuerCredentials(Model): 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, *, account_id: str=None, password: str=None, **kwargs) -> None: + def __init__( + self, + *, + account_id: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): super(IssuerCredentials, self).__init__(**kwargs) self.account_id = account_id self.password = password -class IssuerParameters(Model): +class IssuerParameters(msrest.serialization.Model): """Parameters for the issuer of the X509 component of a certificate. - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. :type name: str - :param certificate_type: Type of certificate to be requested from the - issuer provider. + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. :type certificate_type: str - :param certificate_transparency: Indicates if the certificates generated - under this policy should be published to certificate transparency logs. + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. :type certificate_transparency: bool """ @@ -2007,21 +2228,27 @@ class IssuerParameters(Model): 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, } - def __init__(self, *, name: str=None, certificate_type: str=None, certificate_transparency: bool=None, **kwargs) -> None: + def __init__( + self, + *, + name: Optional[str] = None, + certificate_type: Optional[str] = None, + certificate_transparency: Optional[bool] = None, + **kwargs + ): super(IssuerParameters, self).__init__(**kwargs) self.name = name self.certificate_type = certificate_type self.certificate_transparency = certificate_transparency -class JsonWebKey(Model): +class JsonWebKey(msrest.serialization.Model): """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. :param kid: Key identifier. :type kid: str - :param kty: JsonWebKey Key Type (kty), as defined in - https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param kty: JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf- + jose-json-web-algorithms-40. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType :param key_ops: :type key_ops: list[str] @@ -2045,9 +2272,8 @@ class JsonWebKey(Model): :type k: bytes :param t: HSM Token, used with 'Bring Your Own Key'. :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param crv: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type crv: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName :param x: X component of an EC public key. :type x: bytes @@ -2074,7 +2300,27 @@ class JsonWebKey(Model): 'y': {'key': 'y', 'type': 'base64'}, } - def __init__(self, *, kid: str=None, kty=None, key_ops=None, n: bytes=None, e: bytes=None, d: bytes=None, dp: bytes=None, dq: bytes=None, qi: bytes=None, p: bytes=None, q: bytes=None, k: bytes=None, t: bytes=None, crv=None, x: bytes=None, y: bytes=None, **kwargs) -> None: + def __init__( + self, + *, + kid: Optional[str] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[str]] = None, + n: Optional[bytes] = None, + e: Optional[bytes] = None, + d: Optional[bytes] = None, + dp: Optional[bytes] = None, + dq: Optional[bytes] = None, + qi: Optional[bytes] = None, + p: Optional[bytes] = None, + q: Optional[bytes] = None, + k: Optional[bytes] = None, + t: Optional[bytes] = None, + crv: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + x: Optional[bytes] = None, + y: Optional[bytes] = None, + **kwargs + ): super(JsonWebKey, self).__init__(**kwargs) self.kid = kid self.kty = kty @@ -2097,27 +2343,24 @@ def __init__(self, *, kid: str=None, kty=None, key_ops=None, n: bytes=None, e: b class KeyAttributes(Attributes): """The attributes of a key managed by the key vault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for keys in the + current vault. If it contains 'Purgeable' the key can be permanently deleted by a privileged + user; otherwise, only the system can purge the key, at the end of the retention interval. + Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2135,38 +2378,41 @@ class KeyAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class KeyCreateParameters(Model): +class KeyCreateParameters(msrest.serialization.Model): """The key create parameters. All required parameters must be populated in order to send to Azure. - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' + :param kty: Required. The type of key to create. For valid values, see JsonWebKeyType. Possible + values include: "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ _validation = { - 'kty': {'required': True, 'min_length': 1}, + 'kty': {'required': True}, } _attribute_map = { @@ -2178,7 +2424,17 @@ class KeyCreateParameters(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, *, kty, key_size: int=None, key_ops=None, key_attributes=None, tags=None, curve=None, **kwargs) -> None: + def __init__( + self, + *, + kty: Union[str, "JsonWebKeyType"], + key_size: Optional[int] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): super(KeyCreateParameters, self).__init__(**kwargs) self.kty = kty self.key_size = key_size @@ -2188,18 +2444,18 @@ def __init__(self, *, kty, key_size: int=None, key_ops=None, key_attributes=None self.curve = curve -class KeyImportParameters(Model): +class KeyImportParameters(msrest.serialization.Model): """The key import parameters. All required parameters must be populated in order to send to Azure. :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool - :param key: Required. The Json web key + :param key: Required. The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2214,7 +2470,15 @@ class KeyImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key: "JsonWebKey", + hsm: Optional[bool] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyImportParameters, self).__init__(**kwargs) self.hsm = hsm self.key = key @@ -2222,14 +2486,13 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags -class KeyListResult(Model): +class KeyListResult(msrest.serialization.Model): """The key list result. - 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 value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. + :ivar value: A response message containing a list of keys in the key vault along with a link to + the next page of keys. :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] :ivar next_link: The URL to get the next set of keys. :vartype next_link: str @@ -2245,19 +2508,21 @@ class KeyListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyOperationResult(Model): +class KeyOperationResult(msrest.serialization.Model): """The key operation result. - 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 kid: Key identifier + :ivar kid: Key identifier. :vartype kid: str :ivar result: :vartype result: bytes @@ -2273,27 +2538,29 @@ class KeyOperationResult(Model): 'result': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyOperationResult, self).__init__(**kwargs) self.kid = None self.result = None -class KeyOperationsParameters(Model): +class KeyOperationsParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: Required. algorithm identifier. Possible values include: "RSA-OAEP", "RSA- + OAEP-256", "RSA1_5". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -2302,29 +2569,32 @@ class KeyOperationsParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeyEncryptionAlgorithm"], + value: bytes, + **kwargs + ): super(KeyOperationsParameters, self).__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyProperties(Model): +class KeyProperties(msrest.serialization.Model): """Properties of the key pair backing a certificate. :param exportable: Indicates if the private key can be exported. :type exportable: bool - :param key_type: The type of key pair to be used for the certificate. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". :type key_type: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. :type reuse_key: bool - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName """ @@ -2336,7 +2606,16 @@ class KeyProperties(Model): 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, *, exportable: bool=None, key_type=None, key_size: int=None, reuse_key: bool=None, curve=None, **kwargs) -> None: + def __init__( + self, + *, + exportable: Optional[bool] = None, + key_type: Optional[Union[str, "JsonWebKeyType"]] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): super(KeyProperties, self).__init__(**kwargs) self.exportable = exportable self.key_type = key_type @@ -2345,13 +2624,12 @@ def __init__(self, *, exportable: bool=None, key_type=None, key_size: int=None, self.curve = curve -class KeyRestoreParameters(Model): +class KeyRestoreParameters(msrest.serialization.Model): """The key restore parameters. All required parameters must be populated in order to send to Azure. - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. + :param key_bundle_backup: Required. The backup blob associated with a key bundle. :type key_bundle_backup: bytes """ @@ -2363,29 +2641,32 @@ class KeyRestoreParameters(Model): 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, key_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + key_bundle_backup: bytes, + **kwargs + ): super(KeyRestoreParameters, self).__init__(**kwargs) self.key_bundle_backup = key_bundle_backup -class KeySignParameters(Model): +class KeySignParameters(msrest.serialization.Model): """The key operations parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm identifier. For more information + on possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: + "PS256", "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", + "ES256K". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param value: Required. :type value: bytes """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'value': {'required': True}, } @@ -2394,22 +2675,27 @@ class KeySignParameters(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + value: bytes, + **kwargs + ): super(KeySignParameters, self).__init__(**kwargs) self.algorithm = algorithm self.value = value -class KeyUpdateParameters(Model): +class KeyUpdateParameters(msrest.serialization.Model): """The key update parameters. - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2419,20 +2705,26 @@ class KeyUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, key_ops=None, key_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_attributes: Optional["KeyAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(KeyUpdateParameters, self).__init__(**kwargs) self.key_ops = key_ops self.key_attributes = key_attributes self.tags = tags -class KeyVaultError(Model): +class KeyVaultError(msrest.serialization.Model): """The key vault error exception. - 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 error: + :ivar error: The key vault server error. :vartype error: ~azure.keyvault.v7_0.models.Error """ @@ -2444,38 +2736,23 @@ class KeyVaultError(Model): 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyVaultError, self).__init__(**kwargs) self.error = None -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): +class KeyVerifyParameters(msrest.serialization.Model): """The key verify parameters. All required parameters must be populated in order to send to Azure. - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: Required. The signing/verification algorithm. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. Possible values include: "PS256", + "PS384", "PS512", "RS256", "RS384", "RS512", "RSNULL", "ES256", "ES384", "ES512", "ES256K". + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param digest: Required. The digest used for signing. :type digest: bytes :param signature: Required. The signature to be verified. @@ -2483,7 +2760,7 @@ class KeyVerifyParameters(Model): """ _validation = { - 'algorithm': {'required': True, 'min_length': 1}, + 'algorithm': {'required': True}, 'digest': {'required': True}, 'signature': {'required': True}, } @@ -2494,18 +2771,24 @@ class KeyVerifyParameters(Model): 'signature': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, algorithm, digest: bytes, signature: bytes, **kwargs) -> None: + def __init__( + self, + *, + algorithm: Union[str, "JsonWebKeySignatureAlgorithm"], + digest: bytes, + signature: bytes, + **kwargs + ): super(KeyVerifyParameters, self).__init__(**kwargs) self.algorithm = algorithm self.digest = digest self.signature = signature -class KeyVerifyResult(Model): +class KeyVerifyResult(msrest.serialization.Model): """The key verify result. - 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 value: True if the signature is verified, otherwise false. :vartype value: bool @@ -2519,14 +2802,16 @@ class KeyVerifyResult(Model): 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(KeyVerifyResult, self).__init__(**kwargs) self.value = None -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. :param trigger: The condition that will execute the action. :type trigger: ~azure.keyvault.v7_0.models.Trigger @@ -2539,20 +2824,25 @@ class LifetimeAction(Model): 'action': {'key': 'action', 'type': 'Action'}, } - def __init__(self, *, trigger=None, action=None, **kwargs) -> None: + def __init__( + self, + *, + trigger: Optional["Trigger"] = None, + action: Optional["Action"] = None, + **kwargs + ): super(LifetimeAction, self).__init__(**kwargs) self.trigger = trigger self.action = action -class OrganizationDetails(Model): +class OrganizationDetails(msrest.serialization.Model): """Details of the organization of the certificate issuer. :param id: Id of the organization. :type id: str :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v7_0.models.AdministratorDetails] + :type admin_details: list[~azure.keyvault.v7_0.models.AdministratorDetails] """ _attribute_map = { @@ -2560,20 +2850,24 @@ class OrganizationDetails(Model): 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, *, id: str=None, admin_details=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + admin_details: Optional[List["AdministratorDetails"]] = None, + **kwargs + ): super(OrganizationDetails, self).__init__(**kwargs) self.id = id self.admin_details = admin_details -class PendingCertificateSigningRequestResult(Model): +class PendingCertificateSigningRequestResult(msrest.serialization.Model): """The pending certificate signing request result. - 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 value: The pending certificate signing request as Base64 encoded - string. + :ivar value: The pending certificate signing request as Base64 encoded string. :vartype value: str """ @@ -2585,32 +2879,31 @@ class PendingCertificateSigningRequestResult(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None -class SasDefinitionAttributes(Model): +class SasDefinitionAttributes(msrest.serialization.Model): """The SAS definition management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for SAS definitions in the current vault. If it contains - 'Purgeable' the SAS definition can be permanently deleted by a privileged - user; otherwise, only the system can purge the SAS definition, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for SAS + definitions in the current vault. If it contains 'Purgeable' the SAS definition can be + permanently deleted by a privileged user; otherwise, only the system can purge the SAS + definition, at the end of the retention interval. Possible values include: "Purgeable", + "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2626,7 +2919,12 @@ class SasDefinitionAttributes(Model): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(SasDefinitionAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None @@ -2634,25 +2932,23 @@ def __init__(self, *, enabled: bool=None, **kwargs) -> None: self.recovery_level = None -class SasDefinitionCreateParameters(Model): +class SasDefinitionCreateParameters(msrest.serialization.Model): """The SAS definition create parameters. All required parameters must be populated in order to send to Azure. - :param template_uri: Required. The SAS definition token template signed - with an arbitrary key. Tokens created according to the SAS definition - will have the same properties as the template. + :param template_uri: Required. The SAS definition token template signed with an arbitrary key. + Tokens created according to the SAS definition will have the same properties as the template. :type template_uri: str - :param sas_type: Required. The type of SAS token the SAS definition will - create. Possible values include: 'account', 'service' + :param sas_type: Required. The type of SAS token the SAS definition will create. Possible + values include: "account", "service". :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: Required. The validity period of SAS tokens - created according to the SAS definition. + :param validity_period: Required. The validity period of SAS tokens created according to the + SAS definition. :type validity_period: str :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2670,7 +2966,16 @@ class SasDefinitionCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, template_uri: str, sas_type, validity_period: str, sas_definition_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + template_uri: str, + sas_type: Union[str, "SasTokenType"], + validity_period: str, + sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SasDefinitionCreateParameters, self).__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type @@ -2679,14 +2984,13 @@ def __init__(self, *, template_uri: str, sas_type, validity_period: str, sas_def self.tags = tags -class SasDefinitionListResult(Model): +class SasDefinitionListResult(msrest.serialization.Model): """The storage account SAS definition list result. - 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 value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. + :ivar value: A response message containing a list of SAS definitions along with a link to the + next page of SAS definitions. :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] :ivar next_link: The URL to get the next set of SAS definitions. :vartype next_link: str @@ -2702,29 +3006,30 @@ class SasDefinitionListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SasDefinitionListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SasDefinitionUpdateParameters(Model): +class SasDefinitionUpdateParameters(msrest.serialization.Model): """The SAS definition update parameters. - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' + :param sas_type: The type of SAS token the SAS definition will create. Possible values include: + "account", "service". :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. + :param validity_period: The validity period of SAS tokens created according to the SAS + definition. :type validity_period: str :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2736,7 +3041,16 @@ class SasDefinitionUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, template_uri: str=None, sas_type=None, validity_period: str=None, sas_definition_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + template_uri: Optional[str] = None, + sas_type: Optional[Union[str, "SasTokenType"]] = None, + validity_period: Optional[str] = None, + sas_definition_attributes: Optional["SasDefinitionAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SasDefinitionUpdateParameters, self).__init__(**kwargs) self.template_uri = template_uri self.sas_type = sas_type @@ -2748,27 +3062,24 @@ def __init__(self, *, template_uri: str=None, sas_type=None, validity_period: st class SecretAttributes(Attributes): """The secret management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for secrets in + the current vault. If it contains 'Purgeable', the secret can be permanently deleted by a + privileged user; otherwise, only the system can purge the secret, at the end of the retention + interval. Possible values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2786,19 +3097,25 @@ class SecretAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recovery_level = None -class SecretListResult(Model): +class SecretListResult(msrest.serialization.Model): """The secret list result. - 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 value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. + :ivar value: A response message containing a list of secrets in the key vault along with a link + to the next page of secrets. :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] :ivar next_link: The URL to get the next set of secrets. :vartype next_link: str @@ -2814,13 +3131,16 @@ class SecretListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(SecretListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2831,18 +3151,22 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, *, content_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + content_type: Optional[str] = None, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(Model): +class SecretRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. + :param secret_bundle_backup: Required. The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes """ @@ -2854,19 +3178,24 @@ class SecretRestoreParameters(Model): 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, secret_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + secret_bundle_backup: bytes, + **kwargs + ): super(SecretRestoreParameters, self).__init__(**kwargs) self.secret_bundle_backup = secret_bundle_backup -class SecretSetParameters(Model): +class SecretSetParameters(msrest.serialization.Model): """The secret set parameters. All required parameters must be populated in order to send to Azure. :param value: Required. The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param content_type: Type of the secret value such as a password. :type content_type: str @@ -2885,7 +3214,15 @@ class SecretSetParameters(Model): 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, } - def __init__(self, *, value: str, tags=None, content_type: str=None, secret_attributes=None, **kwargs) -> None: + def __init__( + self, + *, + value: str, + tags: Optional[Dict[str, str]] = None, + content_type: Optional[str] = None, + secret_attributes: Optional["SecretAttributes"] = None, + **kwargs + ): super(SecretSetParameters, self).__init__(**kwargs) self.value = value self.tags = tags @@ -2893,14 +3230,14 @@ def __init__(self, *, value: str, tags=None, content_type: str=None, secret_attr self.secret_attributes = secret_attributes -class SecretUpdateParameters(Model): +class SecretUpdateParameters(msrest.serialization.Model): """The secret update parameters. :param content_type: Type of the secret value such as a password. :type content_type: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2910,34 +3247,37 @@ class SecretUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, content_type: str=None, secret_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + content_type: Optional[str] = None, + secret_attributes: Optional["SecretAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(SecretUpdateParameters, self).__init__(**kwargs) self.content_type = content_type self.secret_attributes = secret_attributes self.tags = tags -class StorageAccountAttributes(Model): +class StorageAccountAttributes(msrest.serialization.Model): """The storage account management attributes. - 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. :param enabled: the enabled state of the object. :type enabled: bool :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for storage accounts in the current vault. If it contains - 'Purgeable' the storage account can be permanently deleted by a privileged - user; otherwise, only the system can purge the storage account, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_0.models.DeletionRecoveryLevel + :vartype updated: ~datetime.datetime + :ivar recovery_level: Reflects the deletion recovery level currently in effect for storage + accounts in the current vault. If it contains 'Purgeable' the storage account can be + permanently deleted by a privileged user; otherwise, only the system can purge the storage + account, at the end of the retention interval. Possible values include: "Purgeable", + "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_0.models.DeletionRecoveryLevel """ _validation = { @@ -2953,7 +3293,12 @@ class StorageAccountAttributes(Model): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): super(StorageAccountAttributes, self).__init__(**kwargs) self.enabled = enabled self.created = None @@ -2961,7 +3306,7 @@ def __init__(self, *, enabled: bool=None, **kwargs) -> None: self.recovery_level = None -class StorageAccountCreateParameters(Model): +class StorageAccountCreateParameters(msrest.serialization.Model): """The storage account create parameters. All required parameters must be populated in order to send to Azure. @@ -2970,16 +3315,14 @@ class StorageAccountCreateParameters(Model): :type resource_id: str :param active_key_name: Required. Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. + :param auto_regenerate_key: Required. whether keyvault should manage the storage account for + the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -2998,7 +3341,17 @@ class StorageAccountCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, resource_id: str, active_key_name: str, auto_regenerate_key: bool, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + resource_id: str, + active_key_name: str, + auto_regenerate_key: bool, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(StorageAccountCreateParameters, self).__init__(**kwargs) self.resource_id = resource_id self.active_key_name = active_key_name @@ -3008,7 +3361,7 @@ def __init__(self, *, resource_id: str, active_key_name: str, auto_regenerate_ke self.tags = tags -class StorageAccountRegenerteKeyParameters(Model): +class StorageAccountRegenerteKeyParameters(msrest.serialization.Model): """The storage account key regenerate parameters. All required parameters must be populated in order to send to Azure. @@ -3025,26 +3378,28 @@ class StorageAccountRegenerteKeyParameters(Model): 'key_name': {'key': 'keyName', 'type': 'str'}, } - def __init__(self, *, key_name: str, **kwargs) -> None: + def __init__( + self, + *, + key_name: str, + **kwargs + ): super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) self.key_name = key_name -class StorageAccountUpdateParameters(Model): +class StorageAccountUpdateParameters(msrest.serialization.Model): """The storage account update parameters. :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -3056,7 +3411,16 @@ class StorageAccountUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + active_key_name: Optional[str] = None, + auto_regenerate_key: Optional[bool] = None, + regeneration_period: Optional[str] = None, + storage_account_attributes: Optional["StorageAccountAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(StorageAccountUpdateParameters, self).__init__(**kwargs) self.active_key_name = active_key_name self.auto_regenerate_key = auto_regenerate_key @@ -3065,14 +3429,13 @@ def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, self.tags = tags -class StorageListResult(Model): +class StorageListResult(msrest.serialization.Model): """The storage accounts list result. - 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 value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. + :ivar value: A response message containing a list of storage accounts in the key vault along + with a link to the next page of storage accounts. :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] :ivar next_link: The URL to get the next set of storage accounts. :vartype next_link: str @@ -3088,19 +3451,21 @@ class StorageListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(StorageListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class StorageRestoreParameters(Model): +class StorageRestoreParameters(msrest.serialization.Model): """The secret restore parameters. All required parameters must be populated in order to send to Azure. - :param storage_bundle_backup: Required. The backup blob associated with a - storage account. + :param storage_bundle_backup: Required. The backup blob associated with a storage account. :type storage_bundle_backup: bytes """ @@ -3112,12 +3477,17 @@ class StorageRestoreParameters(Model): 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, storage_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + storage_bundle_backup: bytes, + **kwargs + ): super(StorageRestoreParameters, self).__init__(**kwargs) self.storage_bundle_backup = storage_bundle_backup -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -3134,23 +3504,29 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, *, emails=None, dns_names=None, upns=None, **kwargs) -> None: + def __init__( + self, + *, + emails: Optional[List[str]] = None, + dns_names: Optional[List[str]] = None, + upns: Optional[List[str]] = None, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -3163,27 +3539,30 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, *, lifetime_percentage: int=None, days_before_expiry: int=None, **kwargs) -> None: + def __init__( + self, + *, + lifetime_percentage: Optional[int] = None, + days_before_expiry: Optional[int] = None, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v7_0.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v7_0.models.SubjectAlternativeNames :param key_usage: List of key usages. :type key_usage: list[str or ~azure.keyvault.v7_0.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -3199,7 +3578,16 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, *, subject: str=None, ekus=None, subject_alternative_names=None, key_usage=None, validity_in_months: int=None, **kwargs) -> None: + def __init__( + self, + *, + subject: Optional[str] = None, + ekus: Optional[List[str]] = None, + subject_alternative_names: Optional["SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + validity_in_months: Optional[int] = None, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = subject self.ekus = ekus diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/__init__.py index 603e37d3ee0..44bfc9d07bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/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 ._key_vault_client_operations import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_key_vault_client_operations.py index da216d1db65..95c7f38157c 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/operations/_key_vault_client_operations.py @@ -1,2524 +1,2716 @@ # 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 TYPE_CHECKING +import warnings -from azure.core.exceptions import map_error +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged -from .. import models -import uuid +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from .. import models -class KeyVaultClientOperationsMixin(object): +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. +class KeyVaultClientOperationsMixin(object): - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + def create_key( + self, + vault_base_url, # type: str + key_name, # type: str + kty, # type: Union[str, "models.JsonWebKeyType"] + key_size=None, # type: Optional[int] + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + curve=None, # type: Optional[Union[str, "models.JsonWebKeyCurveName"]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """Creates a new key, stores it, then returns key parameters and attributes to the client. + + The create key operation can be used to create any key type in Azure Key Vault. If the named + key already exists, Azure Key Vault creates a new version of the key. It requires the + keys/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. + :param key_name: The name for the new key. The system will generate the version name for the + new key. :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' + :param kty: The type of key to create. For valid values, see JsonWebKeyType. :type kty: str or ~azure.keyvault.v7_0.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :type key_size: int :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'P-256K' + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. :type curve: str or ~azure.keyvault.v7_0.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_key.metadata['url'] + url = self.create_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + create_key.metadata = {'url': '/keys/{key-name}/create'} # type: ignore + + def import_key( + self, + vault_base_url, # type: str + key_name, # type: str + key, # type: "models.JsonWebKey" + hsm=None, # type: Optional[bool] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """Imports an externally created key, stores it, and returns key parameters and attributes to the client. + + The import key operation may be used to import any key type into an Azure Key Vault. If the + named key already exists, Azure Key Vault creates a new version of the key. This operation + requires the keys/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: Name for the imported key. :type key_name: str - :param key: The Json web key + :param key: The Json web key. :type key: ~azure.keyvault.v7_0.models.JsonWebKey :param hsm: Whether to import as a hardware key (HSM) or software key. :type hsm: bool :param key_attributes: The key management attributes. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_key.metadata['url'] + url = self.import_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): + import_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + def delete_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedKeyBundle" """Deletes a key of any type from storage in Azure Key Vault. - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the + The delete key operation cannot be used to remove individual versions of a key. This operation + removes the cryptographic material associated with the key, which means the key is not usable + for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the keys/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to delete. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_key.metadata['url'] + url = self.delete_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} - - def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. - - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_key.metadata = {'url': '/keys/{key-name}'} # type: ignore + + def update_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + key_ops=None, # type: Optional[List[Union[str, "models.JsonWebKeyOperation"]]] + key_attributes=None, # type: Optional["models.KeyAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" + """The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. + + In order to perform this operation, the key must already exist in the Key Vault. Note: The + cryptographic material of a key itself cannot be changed. This operation requires the + keys/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of key to update. :type key_name: str :param key_version: The version of the key to update. :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_0.models.JsonWebKeyOperation] - :param key_attributes: + :param key_ops: Json web key operations. For more information on possible key operations, see + JsonWebKeyOperation. + :type key_ops: list[str or ~azure.keyvault.v7_0.models.JsonWebKeyOperation] + :param key_attributes: The attributes of a key managed by the key vault service. :type key_attributes: ~azure.keyvault.v7_0.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_key.metadata['url'] + url = self.update_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): + update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore + + def get_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Gets the public part of a stored key. - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. + The get key operation is applicable to all key types. If the requested key is symmetric, then + no key material is released in the response. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key to get. :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. + :param key_version: Adding the version parameter retrieves a specific version of a key. This + URI fragment is optional. If not specified, the latest version of the key is returned. :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_key.metadata['url'] + url = self.get_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} + get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} # type: ignore def get_key_versions( - self, vault_base_url, key_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + key_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.KeyListResult"] """Retrieves a list of individual key versions with the same key name. - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. + The full key identifier, attributes, and tags are provided in the response. This operation + requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_key_versions.metadata['url'] + url = self.get_key_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'key-name': self._serialize.url("key_name", key_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} + get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} # type: ignore def get_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.KeyListResult"] """List keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a stored key. The LIST operation is applicable to all key types, however only + the base key identifier, attributes, and tags are provided in the response. Individual versions + of a key are not listed in the response. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_keys.metadata['url'] + url = self.get_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_keys.metadata = {'url': '/keys'} - - def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_keys.metadata = {'url': '/keys'} # type: ignore + + def backup_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupKeyResult" + """Requests that a backup of the specified key be downloaded to the client. + + The Key Backup operation exports a key from Azure Key Vault in a protected form. Note that this + operation does NOT return key material in a form that can be used outside the Azure Key Vault + system, the returned key material is either protected to a Azure Key Vault HSM or to Azure Key + Vault itself. The intent of this operation is to allow a client to GENERATE a key in one Azure + Key Vault instance, BACKUP the key, and then RESTORE it into another Azure Key Vault instance. + The BACKUP operation may be used to export, in protected form, any key type from Azure Key + Vault. Individual versions of a key cannot be backed up. BACKUP / RESTORE can be performed + within geographical boundaries only; meaning that a BACKUP from one geographical area cannot be + restored to another geographical area. For example, a backup from the US geographical area + cannot be restored in an EU geographical area. This operation requires the key/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupKeyResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupKeyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_key.metadata['url'] + url = self.backup_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) + deserialized = self._deserialize('BackupKeyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): + backup_key.metadata = {'url': '/keys/{key-name}/backup'} # type: ignore + + def restore_key( + self, + vault_base_url, # type: str + key_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Restores a backed up key to a vault. - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + Imports a previously backed up key into Azure Key Vault, restoring the key, its key identifier, + attributes and access control policies. The RESTORE operation may be used to import a + previously backed up key. Individual versions of a key cannot be restored. The key is restored + in its entirety with the same key name as it had when it was backed up. If the key name is not + available in the target Key Vault, the RESTORE operation will be rejected. While the key name + is retained during restore, the final key identifier will change if the key is restored to a + different vault. Restore will restore all versions and preserve version identifiers. The + RESTORE operation is subject to security constraints: The target Key Vault must be owned by the + same Microsoft Azure Subscription as the source Key Vault The user must have RESTORE permission + in the target Key Vault. This operation requires the keys/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. + :param key_bundle_backup: The backup blob associated with a key bundle. :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_key.metadata['url'] + url = self.restore_key.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + restore_key.metadata = {'url': '/keys/restore'} # type: ignore + + def encrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" + """Encrypts an arbitrary sequence of bytes using an encryption key that is stored in a key vault. + + The ENCRYPT operation encrypts an arbitrary sequence of bytes using an encryption key that is + stored in Azure Key Vault. Note that the ENCRYPT operation only supports a single block of + data, the size of which is dependent on the target key and the encryption algorithm to be used. + The ENCRYPT operation is only strictly necessary for symmetric keys stored in Azure Key Vault + since protection with an asymmetric key can be performed using public portion of the key. This + operation is supported for asymmetric keys as a convenience for callers that have a key- + reference but do not have access to the public key material. This operation requires the + keys/encrypt permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.encrypt.metadata['url'] + url = self.encrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} # type: ignore + + def decrypt( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Decrypts a single block of encrypted data. - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. + The DECRYPT operation decrypts a well-formed block of ciphertext using the target encryption + key and specified algorithm. This operation is the reverse of the ENCRYPT operation; only a + single block of data may be decrypted, the size of this block is dependent on the target key + and the algorithm to be used. The DECRYPT operation applies to asymmetric and symmetric keys + stored in Azure Key Vault since it uses the private portion of the key. This operation requires + the keys/decrypt permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.decrypt.metadata['url'] + url = self.decrypt.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} # type: ignore + + def sign( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Creates a signature from a digest using the specified key. - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. + The SIGN operation is applicable to asymmetric and symmetric keys stored in Azure Key Vault + since this operation uses the private portion of the key. This operation requires the keys/sign + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm identifier. For more information on + possible algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeySignParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.sign.metadata['url'] + url = self.sign.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeySignParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, cls=None, **kwargs): + sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} # type: ignore + + def verify( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeySignatureAlgorithm"] + digest, # type: bytes + signature, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyVerifyResult" """Verifies a signature using a specified key. - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. + The VERIFY operation is applicable to symmetric keys stored in Azure Key Vault. VERIFY is not + strictly necessary for asymmetric keys stored in Azure Key Vault since signature verification + can be performed using the public portion of the key but this operation is supported as a + convenience for callers that only have a key-reference and not the public portion of the key. + This operation requires the keys/verify permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm + :param algorithm: The signing/verification algorithm. For more information on possible + algorithm types, see JsonWebKeySignatureAlgorithm. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeySignatureAlgorithm :param digest: The digest used for signing. :type digest: bytes :param signature: The signature to be verified. :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyVerifyResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyVerifyResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.verify.metadata['url'] + url = self.verify.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyVerifyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) + deserialized = self._deserialize('KeyVerifyResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): + verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} # type: ignore + + def wrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" """Wraps a symmetric key using a specified key. - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + The WRAP operation supports encryption of a symmetric key using a key encryption key that has + previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for + symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be + performed using the public portion of the key. This operation is supported for asymmetric keys + as a convenience for callers that have a key-reference but do not have access to the public key + material. This operation requires the keys/wrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.wrap_key.metadata['url'] + url = self.wrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} # type: ignore + + def unwrap_key( + self, + vault_base_url, # type: str + key_name, # type: str + key_version, # type: str + algorithm, # type: Union[str, "models.JsonWebKeyEncryptionAlgorithm"] + value, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.KeyOperationResult" + """Unwraps a symmetric key using the specified key that was initially used for wrapping that key. + + The UNWRAP operation supports decryption of a symmetric key using the target key encryption + key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to + asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of + the key. This operation requires the keys/unwrapKey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str :param key_version: The version of the key. :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm + :param algorithm: algorithm identifier. + :type algorithm: str or ~azure.keyvault.v7_0.models.JsonWebKeyEncryptionAlgorithm :param value: :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyOperationResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyOperationResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.unwrap_key.metadata['url'] + url = self.unwrap_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'key-version': self._serialize.url("key_version", key_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'KeyOperationsParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) + deserialized = self._deserialize('KeyOperationResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} + unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} # type: ignore def get_deleted_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedKeyListResult"] """Lists the deleted keys in the specified vault. - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. + Retrieves a list of the keys in the Key Vault as JSON Web Key structures that contain the + public part of a deleted key. This operation includes deletion-specific information. The Get + Deleted Keys operation is applicable for vaults enabled for soft-delete. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedKeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_keys.metadata['url'] + url = self.get_deleted_keys.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedKeyListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedKeyListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + get_deleted_keys.metadata = {'url': '/deletedkeys'} # type: ignore + + def get_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedKeyBundle" """Gets the public part of a deleted key. - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . + The Get Deleted Key operation is applicable for soft-delete enabled vaults. While the operation + can be invoked on any vault, it will return an error if invoked on a non soft-delete enabled + vault. This operation requires the keys/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedKeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedKeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_key.metadata['url'] + url = self.get_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + deserialized = self._deserialize('DeletedKeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore + + def purge_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified key. - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. + The Purge Deleted Key operation is applicable for soft-delete enabled vaults. While the + operation can be invoked on any vault, it will return an error if invoked on a non soft-delete + enabled vault. This operation requires the keys/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of the key + :param key_name: The name of the key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_key.metadata['url'] + url = self.purge_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} # type: ignore - def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): + def recover_deleted_key( + self, + vault_base_url, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.KeyBundle" """Recovers the deleted key to its latest version. - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. + The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. + It recovers the deleted key back to its latest version under /keys. An attempt to recover an + non-deleted key will return an error. Consider this the inverse of the delete operation on + soft-delete enabled vaults. This operation requires the keys/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param key_name: The name of the deleted key. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: KeyBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.KeyBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_key.metadata['url'] + url = self.recover_deleted_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'key-name': self._serialize.url("key_name", key_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) + deserialized = self._deserialize('KeyBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, cls=None, **kwargs): + recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} # type: ignore + + def set_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + value, # type: str + tags=None, # type: Optional[Dict[str, str]] + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Sets a secret in a specified key vault. - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. + The SET operation adds a secret to the Azure Key Vault. If the named secret already exists, + Azure Key Vault creates a new version of that secret. This operation requires the secrets/set + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param value: The value of the secret. :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type_parameter, secret_attributes=secret_attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_secret.metadata['url'] + url = self.set_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + set_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + def delete_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSecretBundle" """Deletes a secret from a specified key vault. - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. + The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied + to an individual version of a secret. This operation requires the secrets/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_secret.metadata['url'] + url = self.delete_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_secret.metadata = {'url': '/secrets/{secret-name}'} # type: ignore + + def update_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + content_type_parameter=None, # type: Optional[str] + secret_attributes=None, # type: Optional["models.SecretAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" + """Updates the attributes associated with a specified secret in a given key vault. + + The UPDATE operation changes specified attributes of an existing stored secret. Attributes that + are not specified in the request are left unchanged. The value of a secret itself cannot be + changed. This operation requires the secrets/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str :param secret_version: The version of the secret. :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str + :param content_type_parameter: Type of the secret value such as a password. + :type content_type_parameter: str :param secret_attributes: The secret management attributes. :type secret_attributes: ~azure.keyvault.v7_0.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretUpdateParameters(content_type=content_type_parameter, secret_attributes=secret_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_secret.metadata['url'] + url = self.update_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kwargs): + update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore + + def get_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + secret_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Get a specified secret from a given key vault. - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. + The GET operation is applicable to any secret stored in Azure Key Vault. This operation + requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param secret_version: The version of the secret. + :param secret_version: The version of the secret. This URI fragment is optional. If not + specified, the latest version of the secret is returned. :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_secret.metadata['url'] + url = self.get_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') + 'secret-version': self._serialize.url("secret_version", secret_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} + get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} # type: ignore def get_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SecretListResult"] """List secrets in a specified key vault. - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. + The Get Secrets operation is applicable to the entire vault. However, only the base secret + identifier and its attributes are provided in the response. Individual secret versions are not + listed in the response. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secrets.metadata['url'] + url = self.get_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_secrets.metadata = {'url': '/secrets'} + get_secrets.metadata = {'url': '/secrets'} # type: ignore def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + secret_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SecretListResult"] """List all versions of the specified secret. - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. + The full secret identifier and attributes are provided in the response. No values are returned + for the secrets. This operations requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified, the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_secret_versions.metadata['url'] + url = self.get_secret_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} + get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} # type: ignore def get_deleted_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedSecretListResult"] """Lists deleted secrets for the specified vault. - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. + The Get Deleted Secrets operation returns the secrets that have been deleted for a vault + enabled for soft-delete. This operation requires the secrets/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_secrets.metadata['url'] + url = self.get_deleted_secrets.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedSecretListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSecretListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + get_deleted_secrets.metadata = {'url': '/deletedsecrets'} # type: ignore + + def get_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSecretBundle" """Gets the specified deleted secret. - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. + The Get Deleted Secret operation returns the specified deleted secret along with its + attributes. This operation requires the secrets/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_secret.metadata['url'] + url = self.get_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) + deserialized = self._deserialize('DeletedSecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore + + def purge_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified secret. - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. + The purge deleted secret operation removes the secret permanently, without the possibility of + recovery. This operation can only be enabled on a soft-delete enabled vault. This operation + requires the secrets/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_secret.metadata['url'] + url = self.purge_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} # type: ignore - def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + def recover_deleted_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Recovers the deleted secret to the latest version. - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. + Recovers the deleted secret in the specified vault. This operation can only be performed on a + soft-delete enabled vault. This operation requires the secrets/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the deleted secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_secret.metadata['url'] + url = self.recover_deleted_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): + recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} # type: ignore + + def backup_secret( + self, + vault_base_url, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupSecretResult" """Backs up the specified secret. - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. + Requests that a backup of the specified secret be downloaded to the client. All versions of the + secret will be downloaded. This operation requires the secrets/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param secret_name: The name of the secret. :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupSecretResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupSecretResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_secret.metadata['url'] + url = self.backup_secret.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') + 'secret-name': self._serialize.url("secret_name", secret_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) + deserialized = self._deserialize('BackupSecretResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwargs): + backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} # type: ignore + + def restore_secret( + self, + vault_base_url, # type: str + secret_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.SecretBundle" """Restores a backed up secret to a vault. - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. + Restores a backed up secret, and all its versions, to a vault. This operation requires the + secrets/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. + :param secret_bundle_backup: The backup blob associated with a secret bundle. :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.SecretBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_secret.metadata['url'] + url = self.restore_secret.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SecretRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) + deserialized = self._deserialize('SecretBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} + restore_secret.metadata = {'url': '/secrets/restore'} # type: ignore def get_certificates( - self, vault_base_url, maxresults=None, include_pending=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + def delete_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + def set_certificate_contacts( + self, + vault_base_url, # type: str + contact_list=None, # type: Optional[List["models.Contact"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v7_0.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def delete_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateIssuerListResult"] """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + def set_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider, # type: str + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -2526,72 +2718,78 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def update_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider=None, # type: Optional[str] + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -2599,1821 +2797,1948 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_0.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_0.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_0.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_0.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def get_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def delete_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def create_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + def import_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + base64_encoded_certificate, # type: str + password=None, # type: Optional[str] + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + certificate_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + def get_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy, # type: "models.CertificatePolicy" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_0.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def get_certificate(self, vault_base_url, certificate_name, certificate_version, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def get_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def update_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + cancellation_requested, # type: bool + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def get_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def delete_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def delete_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def merge_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + x509_certificates, # type: List[bytearray] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_0.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} - - def backup_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + def backup_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupCertificateResult" """Backs up the specified certificate. - Requests that a backup of the specified certificate be downloaded to - the client. All versions of the certificate will be downloaded. This - operation requires the certificates/backup permission. + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupCertificateResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupCertificateResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_certificate.metadata['url'] + url = self.backup_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupCertificateResult', response) + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} - - def restore_certificate(self, vault_base_url, certificate_bundle_backup, cls=None, **kwargs): + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + def restore_certificate( + self, + vault_base_url, # type: str + certificate_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Restores a backed up certificate to a vault. - Restores a backed up certificate, and all its versions, to a vault. - This operation requires the certificates/restore permission. + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_bundle_backup: The backup blob associated with a - certificate bundle. + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. :type certificate_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_certificate.metadata['url'] + url = self.restore_certificate.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': '/certificates/restore'} + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, include_pending=None, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedCertificateListResult"] + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + def get_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def purge_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_certificate.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def recover_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the deleted certificate + :param certificate_name: The name of the deleted certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_certificate.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore def get_storage_accounts( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.StorageListResult"] + """List storage accounts managed by the specified key vault. This operation requires the + storage/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StorageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_storage_accounts.metadata['url'] + url = self.get_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('StorageListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('StorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_storage_accounts.metadata = {'url': '/storage'} + get_storage_accounts.metadata = {'url': '/storage'} # type: ignore def get_deleted_storage_accounts( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedStorageListResult"] """Lists deleted storage accounts for the specified vault. - The Get Deleted Storage Accounts operation returns the storage accounts - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/list permission. + The Get Deleted Storage Accounts operation returns the storage accounts that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedStorageAccountItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedStorageListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_storage_accounts.metadata['url'] + url = self.get_deleted_storage_accounts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedStorageListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedStorageListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} - - def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): + get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} # type: ignore + + def get_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedStorageBundle" """Gets the specified deleted storage account. - The Get Deleted Storage Account operation returns the specified deleted - storage account along with its attributes. This operation requires the - storage/get permission. + The Get Deleted Storage Account operation returns the specified deleted storage account along + with its attributes. This operation requires the storage/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_storage_account.metadata['url'] + url = self.get_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) + deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - def purge_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): + get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} # type: ignore + + def purge_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified storage account. - The purge deleted storage account operation removes the secret - permanently, without the possibility of recovery. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the storage/purge permission. + The purge deleted storage account operation removes the secret permanently, without the + possibility of recovery. This operation can only be performed on a soft-delete enabled vault. + This operation requires the storage/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.purge_deleted_storage_account.metadata['url'] + url = self.purge_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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 = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} + return cls(pipeline_response, None, {}) + + purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} # type: ignore - def recover_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): + def recover_deleted_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" """Recovers the deleted storage account. - Recovers the deleted storage account in the specified vault. This - operation can only be performed on a soft-delete enabled vault. This - operation requires the storage/recover permission. + Recovers the deleted storage account in the specified vault. This operation can only be + performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_storage_account.metadata['url'] + url = self.recover_deleted_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} - - def backup_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): + recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} # type: ignore + + def backup_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupStorageResult" """Backs up the specified storage account. - Requests that a backup of the specified storage account be downloaded - to the client. This operation requires the storage/backup permission. + Requests that a backup of the specified storage account be downloaded to the client. This + operation requires the storage/backup permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupStorageResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupStorageResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.BackupStorageResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupStorageResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.backup_storage_account.metadata['url'] + url = self.backup_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupStorageResult', response) + deserialized = self._deserialize('BackupStorageResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} - - def restore_storage_account(self, vault_base_url, storage_bundle_backup, cls=None, **kwargs): + backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} # type: ignore + + def restore_storage_account( + self, + vault_base_url, # type: str + storage_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" """Restores a backed up storage account to a vault. - Restores a backed up storage account to a vault. This operation - requires the storage/restore permission. + Restores a backed up storage account to a vault. This operation requires the storage/restore + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param storage_bundle_backup: The backup blob associated with a - storage account. + :param storage_bundle_backup: The backup blob associated with a storage account. :type storage_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_storage_account.metadata['url'] + url = self.restore_storage_account.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_storage_account.metadata = {'url': '/storage/restore'} - - def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + restore_storage_account.metadata = {'url': '/storage/restore'} # type: ignore + + def delete_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedStorageBundle" + """Deletes a storage account. This operation requires the storage/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedStorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedStorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_storage_account.metadata['url'] + url = self.delete_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) + deserialized = self._deserialize('DeletedStorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def get_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. + delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def get_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Gets information about a specified storage account. This operation requires the storage/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_storage_account.metadata['url'] + url = self.get_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def set_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + resource_id, # type: str + active_key_name, # type: str + auto_regenerate_key, # type: bool + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Creates or updates a new storage account. This operation requires the storage/set permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str @@ -4421,743 +4746,800 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, :type resource_id: str :param active_key_name: Current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_storage_account.metadata['url'] + url = self.set_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def update_storage_account( + self, + vault_base_url, # type: str + storage_account_name, # type: str + active_key_name=None, # type: Optional[str] + auto_regenerate_key=None, # type: Optional[bool] + regeneration_period=None, # type: Optional[str] + storage_account_attributes=None, # type: Optional["models.StorageAccountAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Updates the specified attributes associated with the given storage account. This operation + requires the storage/set/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param active_key_name: The current active storage account key name. :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. + :param auto_regenerate_key: whether keyvault should manage the storage account for the user. :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. + :param regeneration_period: The key regeneration time duration specified in ISO-8601 format. :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_0.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param storage_account_attributes: The attributes of the storage account. + :type storage_account_attributes: ~azure.keyvault.v7_0.models.StorageAccountAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_storage_account.metadata['url'] + url = self.update_storage_account.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} # type: ignore + + def regenerate_storage_account_key( + self, + vault_base_url, # type: str + storage_account_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.StorageBundle" + """Regenerates the specified key value for the given storage account. This operation requires the + storage/regeneratekey permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param key_name: The storage account key name. :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: StorageBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + cls = kwargs.pop('cls', None) # type: ClsType["models.StorageBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] + url = self.regenerate_storage_account_key.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'StorageAccountRegenerteKeyParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) + deserialized = self._deserialize('StorageBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} + regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} # type: ignore def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + storage_account_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.SasDefinitionListResult"] + """List storage SAS definitions for the given storage account. This operation requires the + storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_sas_definitions.metadata['url'] + url = self.get_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('SasDefinitionListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('SasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} + get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} # type: ignore def get_deleted_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, cls=None, **kwargs): - """Lists deleted SAS definitions for the specified vault and storage - account. - - The Get Deleted Sas Definitions operation returns the SAS definitions - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + self, + vault_base_url, # type: str + storage_account_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedSasDefinitionListResult"] + """Lists deleted SAS definitions for the specified vault and storage account. + + The Get Deleted Sas Definitions operation returns the SAS definitions that have been deleted + for a vault enabled for soft-delete. This operation requires the storage/listsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of DeletedSasDefinitionItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedSasDefinitionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_sas_definitions.metadata['url'] + url = self.get_deleted_sas_definitions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} - - def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): + get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} # type: ignore + + def get_deleted_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSasDefinitionBundle" """Gets the specified deleted sas definition. - The Get Deleted SAS Definition operation returns the specified deleted - SAS definition along with its attributes. This operation requires the - storage/getsas permission. + The Get Deleted SAS Definition operation returns the specified deleted SAS definition along + with its attributes. This operation requires the storage/getsas permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_deleted_sas_definition.metadata['url'] + url = self.get_deleted_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) + deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} - - def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): + get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def recover_deleted_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" """Recovers the deleted SAS definition. - Recovers the deleted SAS definition for the specified storage account. - This operation can only be performed on a soft-delete enabled vault. - This operation requires the storage/recover permission. + Recovers the deleted SAS definition for the specified storage account. This operation can only + be performed on a soft-delete enabled vault. This operation requires the storage/recover + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.recover_deleted_sas_definition.metadata['url'] + url = self.recover_deleted_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} - - def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} # type: ignore + + def delete_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedSasDefinitionBundle" + """Deletes a SAS definition from a specified storage account. This operation requires the + storage/deletesas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedSasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedSasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.delete_sas_definition.metadata['url'] + url = self.delete_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) + deserialized = self._deserialize('DeletedSasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def get_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Gets information about a SAS definition for the specified storage account. This operation + requires the storage/getsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.0" + # Construct URL - url = self.get_sas_definition.metadata['url'] + url = self.get_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def set_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + template_uri, # type: str + sas_type, # type: Union[str, "models.SasTokenType"] + validity_period, # type: str + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Creates or updates a new SAS definition for the specified storage account. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS + :param validity_period: The validity period of SAS tokens created according to the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_sas_definition.metadata['url'] + url = self.set_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri=None, sas_type=None, validity_period=None, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore + + def update_sas_definition( + self, + vault_base_url, # type: str + storage_account_name, # type: str + sas_definition_name, # type: str + template_uri=None, # type: Optional[str] + sas_type=None, # type: Optional[Union[str, "models.SasTokenType"]] + validity_period=None, # type: Optional[str] + sas_definition_attributes=None, # type: Optional["models.SasDefinitionAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.SasDefinitionBundle" + """Updates the specified attributes associated with the given SAS definition. This operation + requires the storage/setsas permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param storage_account_name: The name of the storage account. :type storage_account_name: str :param sas_definition_name: The name of the SAS definition. :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. + :param template_uri: The SAS definition token template signed with an arbitrary key. Tokens + created according to the SAS definition will have the same properties as the template. :type template_uri: str :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' :type sas_type: str or ~azure.keyvault.v7_0.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS + :param validity_period: The validity period of SAS tokens created according to the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_0.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type validity_period: str + :param sas_definition_attributes: The attributes of the SAS definition. + :type sas_definition_attributes: ~azure.keyvault.v7_0.models.SasDefinitionAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SasDefinitionBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_0.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.SasDefinitionBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) + api_version = "7.0" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_sas_definition.metadata['url'] + url = self.update_sas_definition.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') + 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'SasDefinitionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('SasDefinitionBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/py.typed b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/__init__.py index e913d4cf6c4..a6c1f9b7a79 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/__init__.py @@ -1,18 +1,16 @@ # 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 ._key_vault_client import KeyVaultClient __all__ = ['KeyVaultClient'] -from .version import VERSION - -__version__ = VERSION - +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_configuration.py index 68d6f5b6bd2..39357e887d3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_configuration.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_configuration.py @@ -1,43 +1,46 @@ # 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 TYPE_CHECKING + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from .version import VERSION +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "7.1-preview" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +48,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_key_vault_client.py index f380f67e0a8..d9db79ab878 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_key_vault_client.py @@ -1,16 +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. -# +# 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 TYPE_CHECKING + from azure.core import PipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any from ._configuration import KeyVaultClientConfiguration from .operations import KeyVaultClientOperationsMixin @@ -20,29 +23,32 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs # type: Any + ): + # type: (...) -> None base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = PipelineClient(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 = '7.1-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) def close(self): + # type: () -> None self._client.close() + def __enter__(self): + # type: () -> KeyVaultClient self._client.__enter__() return self + def __exit__(self, *exc_details): + # type: (Any) -> None self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_metadata.json new file mode 100644 index 00000000000..1d7cd52ac09 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/_metadata.json @@ -0,0 +1,357 @@ +{ + "chosen_version": "7.1-preview", + "total_api_version_list": ["7.1-preview"], + "client": { + "name": "KeyVaultClient", + "filename": "_key_vault_client", + "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", + "base_url": null, + "custom_base_url": "\u0027{vaultBaseUrl}\u0027", + "azure_arm": false + }, + "global_parameters": { + "sync_method": { + }, + "async_method": { + }, + "constant": { + }, + "call": "" + }, + "config": { + "credential": false, + "credential_scopes": null, + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + }, + "operation_mixins": { + "get_certificates" : { + "sync": { + "signature": "def get_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "delete_certificate" : { + "sync": { + "signature": "def delete_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "set_certificate_contacts" : { + "sync": { + "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contact_list=None, # type: Optional[List[\"models.Contact\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_1.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contact_list: Optional[List[\"models.Contact\"]] = None,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_1.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, contact_list" + }, + "get_certificate_contacts" : { + "sync": { + "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "delete_certificate_contacts" : { + "sync": { + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "get_certificate_issuers" : { + "sync": { + "signature": "def get_certificate_issuers(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateIssuerListResult\"]:\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "set_certificate_issuer" : { + "sync": { + "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider, # type: str\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: str,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "update_certificate_issuer" : { + "sync": { + "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider=None, # type: Optional[str]\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: Optional[str] = None,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "get_certificate_issuer" : { + "sync": { + "signature": "def get_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "delete_certificate_issuer" : { + "sync": { + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "create_certificate" : { + "sync": { + "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags" + }, + "import_certificate" : { + "sync": { + "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n base64_encoded_certificate, # type: str\n password=None, # type: Optional[str]\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n base64_encoded_certificate: str,\n password: Optional[str] = None,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags" + }, + "get_certificate_versions" : { + "sync": { + "signature": "def get_certificate_versions(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, maxresults" + }, + "get_certificate_policy" : { + "sync": { + "signature": "def get_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "update_certificate_policy" : { + "sync": { + "signature": "def update_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy, # type: \"models.CertificatePolicy\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: \"models.CertificatePolicy\",\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy" + }, + "update_certificate" : { + "sync": { + "signature": "def update_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags" + }, + "get_certificate" : { + "sync": { + "signature": "def get_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version" + }, + "update_certificate_operation" : { + "sync": { + "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n cancellation_requested, # type: bool\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n cancellation_requested: bool,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, cancellation_requested" + }, + "get_certificate_operation" : { + "sync": { + "signature": "def get_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "delete_certificate_operation" : { + "sync": { + "signature": "def delete_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "merge_certificate" : { + "sync": { + "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n x509_certificates, # type: List[bytearray]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n x509_certificates: List[bytearray],\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags" + }, + "backup_certificate" : { + "sync": { + "signature": "def backup_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.BackupCertificateResult\":\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "restore_certificate" : { + "sync": { + "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n certificate_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n certificate_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_bundle_backup" + }, + "get_deleted_certificates" : { + "sync": { + "signature": "def get_deleted_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedCertificateListResult\"]:\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "get_deleted_certificate" : { + "sync": { + "signature": "def get_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "purge_deleted_certificate" : { + "sync": { + "signature": "def purge_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "recover_deleted_certificate" : { + "sync": { + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_1.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"List\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/__init__.py index fb2e6c3866f..71ceadebe43 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/__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 ._key_vault_client_async import KeyVaultClient diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_configuration_async.py index fb961bb4bd2..e3684b54d21 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_configuration_async.py @@ -1,43 +1,40 @@ # 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 + from azure.core.configuration import Configuration from azure.core.pipeline import policies -from ..version import VERSION - +VERSION = "unknown" class KeyVaultClientConfiguration(Configuration): - """Configuration for KeyVaultClient + """Configuration for KeyVaultClient. + 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` """ - def __init__(self, credentials, **kwargs): - - if credentials is None: - raise ValueError("Parameter 'credentials' must not be None.") - + def __init__( + self, + **kwargs: Any + ) -> None: super(KeyVaultClientConfiguration, self).__init__(**kwargs) - self._configure(**kwargs) - self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) - self.generate_client_request_id = True - - self.credentials = credentials + self.api_version = "7.1-preview" + kwargs.setdefault('sdk_moniker', 'keyvault/{}'.format(VERSION)) + self._configure(**kwargs) - def _configure(self, **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) @@ -45,3 +42,4 @@ def _configure(self, **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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_key_vault_client_async.py index b2b908c4a75..2d273c4e45f 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/_key_vault_client_async.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 typing import Any + from azure.core import AsyncPipelineClient -from msrest import Serializer, Deserializer +from msrest import Deserializer, Serializer from ._configuration_async import KeyVaultClientConfiguration from .operations_async import KeyVaultClientOperationsMixin @@ -20,29 +19,28 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. - - :param credentials: Credentials needed for the client to connect to Azure. - :type credentials: :mod:`A msrestazure Credentials - object` + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credentials, **kwargs): - + self, + **kwargs: Any + ) -> None: base_url = '{vaultBaseUrl}' - self._config = KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(**kwargs) self._client = AsyncPipelineClient(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 = '7.1-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - async def close(self): + async def close(self) -> None: await self._client.close() - async def __aenter__(self): + + async def __aenter__(self) -> "KeyVaultClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/__init__.py index 771a17ceb80..b887c97a420 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/__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 ._key_vault_client_operations_async import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/_key_vault_client_operations_async.py index 5701d4354d9..42f04f5d0a3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/aio/operations_async/_key_vault_client_operations_async.py @@ -1,412 +1,440 @@ # 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, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar +import warnings -from azure.core.exceptions import map_error 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 ... import models -import uuid +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeyVaultClientOperationsMixin: def get_certificates( - self, vault_base_url, maxresults=None, include_pending=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + async def delete_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + async def set_certificate_contacts( + self, + vault_base_url: str, + contact_list: Optional[List["models.Contact"]] = None, + **kwargs + ) -> "models.Contacts": """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v7_1.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def get_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore - async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): + async def delete_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateIssuerListResult"]: """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: str, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -414,72 +442,77 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: Optional[str] = None, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -487,4738 +520,1336 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def get_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def delete_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - async def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateOperation": """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - async def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, *, cls=None, **kwargs): + self, + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('CertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + async def get_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificatePolicy": """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, *, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: "models.CertificatePolicy", + **kwargs + ) -> "models.CertificatePolicy": """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - async def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, *, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def get_certificate(self, vault_base_url, certificate_name, certificate_version, *, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def get_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs + ) -> "models.CertificateBundle": """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - async def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, *, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + cancellation_requested: bool, + **kwargs + ) -> "models.CertificateOperation": """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def get_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def get_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def delete_certificate_operation(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def delete_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - async def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, *, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + x509_certificates: List[bytearray], + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} - - async def backup_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + async def backup_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.BackupCertificateResult": """Backs up the specified certificate. - Requests that a backup of the specified certificate be downloaded to - the client. All versions of the certificate will be downloaded. This - operation requires the certificates/backup permission. + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupCertificateResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.backup_certificate.metadata['url'] + url = self.backup_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupCertificateResult', response) + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} - - async def restore_certificate(self, vault_base_url, certificate_bundle_backup, *, cls=None, **kwargs): + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + async def restore_certificate( + self, + vault_base_url: str, + certificate_bundle_backup: bytes, + **kwargs + ) -> "models.CertificateBundle": """Restores a backed up certificate to a vault. - Restores a backed up certificate, and all its versions, to a vault. - This operation requires the certificates/restore permission. + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_bundle_backup: The backup blob associated with a - certificate bundle. + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. :type certificate_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_certificate.metadata['url'] + url = self.restore_certificate.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': '/certificates/restore'} + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, include_pending=None, *, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.DeletedCertificateListResult"]: + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - async def extract_data_async(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) - async def get_next_async(next_link=None): + async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, **kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return AsyncItemPaged( - get_next_async, extract_data_async + get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + async def get_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def purge_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> None: """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_certificate.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param certificate_name: The name of the deleted certificate - :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_certificate.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} - - async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, *, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. - - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. - :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. - :type key_size: int - :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) - - # Construct URL - url = self.create_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: Name for the imported key. - :type key_name: str - :param key: The Json web key - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param hsm: Whether to import as a hardware key (HSM) or software key. - :type hsm: bool - :param key_attributes: The key management attributes. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) - - # Construct URL - url = self.import_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Deletes a key of any type from storage in Azure Key Vault. - - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the - keys/delete permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key to delete. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) # Construct URL - url = self.delete_key.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + 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]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, None, {}) - return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore - async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, *, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. + async def recover_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateBundle": + """Recovers the deleted certificate back to its current version under /certificates. - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of key to update. - :type key_name: str - :param key_version: The version of the key to update. - :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_1.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" # Construct URL - url = self.update_key.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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' - 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()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kwargs): - """Gets the public part of a stored key. - - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key to get. - :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. - :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - def get_key_versions( - self, vault_base_url, key_name, maxresults=None, *, cls=None, **kwargs): - """Retrieves a list of individual key versions with the same key name. - - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_key_versions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} - - def get_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """List keys in the specified vault. - - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_keys.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('KeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_keys.metadata = {'url': '/keys'} - - async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kwargs): - """Restores a backed up key to a vault. - - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. - :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) - - # Construct URL - url = self.restore_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.encrypt.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Decrypts a single block of encrypted data. - - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.decrypt.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Creates a signature from a digest using the specified key. - - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.sign.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, *, cls=None, **kwargs): - """Verifies a signature using a specified key. - - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param digest: The digest used for signing. - :type digest: bytes - :param signature: The signature to be verified. - :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) - - # Construct URL - url = self.verify.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Wraps a symmetric key using a specified key. - - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.wrap_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, *, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.unwrap_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} - - def get_deleted_keys( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """Lists the deleted keys in the specified vault. - - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_keys.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('DeletedKeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Gets the public part of a deleted key. - - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Permanently deletes the specified key. - - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key - :type key_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): - """Recovers the deleted key to its latest version. - - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the deleted key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - async def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, *, cls=None, **kwargs): - """Sets a secret in a specified key vault. - - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param value: The value of the secret. - :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) - - # Construct URL - url = self.set_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): - """Deletes a secret from a specified key vault. - - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - async def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param secret_version: The version of the secret. - :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) - - # Construct URL - url = self.update_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=None, **kwargs): - """Get a specified secret from a given key vault. - - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param secret_version: The version of the secret. - :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - def get_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """List secrets in a specified key vault. - - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_secrets.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_secrets.metadata = {'url': '/secrets'} - - def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, *, cls=None, **kwargs): - """List all versions of the specified secret. - - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_secret_versions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('SecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} - - def get_deleted_secrets( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """Lists deleted secrets for the specified vault. - - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_secrets.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('DeletedSecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): - """Gets the specified deleted secret. - - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): - """Permanently deletes the specified secret. - - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): - """Recovers the deleted secret to the latest version. - - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the deleted secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): - """Backs up the specified secret. - - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None, **kwargs): - """Restores a backed up secret to a vault. - - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. - :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) - - # Construct URL - url = self.restore_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} - - def get_storage_accounts( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_storage_accounts.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('StorageListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_storage_accounts.metadata = {'url': '/storage'} - - def get_deleted_storage_accounts( - self, vault_base_url, maxresults=None, *, cls=None, **kwargs): - """Lists deleted storage accounts for the specified vault. - - The Get Deleted Storage Accounts operation returns the storage accounts - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedStorageAccountItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedStorageAccountItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_storage_accounts.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('DeletedStorageListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} - - async def get_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Gets the specified deleted storage account. - - The Get Deleted Storage Account operation returns the specified deleted - storage account along with its attributes. This operation requires the - storage/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - async def purge_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Permanently deletes the specified storage account. - - The purge deleted storage account operation removes the secret - permanently, without the possibility of recovery. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the storage/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - async def recover_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Recovers the deleted storage account. - - Recovers the deleted storage account in the specified vault. This - operation can only be performed on a soft-delete enabled vault. This - operation requires the storage/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} - - async def backup_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Backs up the specified storage account. - - Requests that a backup of the specified storage account be downloaded - to the client. This operation requires the storage/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupStorageResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupStorageResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupStorageResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} - - async def restore_storage_account(self, vault_base_url, storage_bundle_backup, *, cls=None, **kwargs): - """Restores a backed up storage account to a vault. - - Restores a backed up storage account to a vault. This operation - requires the storage/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_bundle_backup: The backup blob associated with a - storage account. - :type storage_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) - - # Construct URL - url = self.restore_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_storage_account.metadata = {'url': '/storage/restore'} - - async def delete_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def get_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param resource_id: Storage account resource id. - :type resource_id: str - :param active_key_name: Current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) - - # Construct URL - url = self.set_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param active_key_name: The current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) - - # Construct URL - url = self.update_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - async def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, *, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param key_name: The storage account key name. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) - - # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} - - def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, *, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_sas_definitions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('SasDefinitionListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} - - def get_deleted_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, *, cls=None, **kwargs): - """Lists deleted SAS definitions for the specified vault and storage - account. - - The Get Deleted Sas Definitions operation returns the SAS definitions - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedSasDefinitionItem - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_1.models.DeletedSasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_sas_definitions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data_async(response): - deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, AsyncList(list_of_elem) - - async def get_next_async(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return AsyncItemPaged( - get_next_async, extract_data_async - ) - get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} - - async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Gets the specified deleted sas definition. - - The Get Deleted SAS Definition operation returns the specified deleted - SAS definition along with its attributes. This operation requires the - storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} - - async def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Recovers the deleted SAS definition. - - Recovers the deleted SAS definition for the specified storage account. - This operation can only be performed on a soft-delete enabled vault. - This operation requires the storage/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} - - async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) - - # Construct URL - url = self.set_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - async def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri=None, sas_type=None, validity_period=None, sas_definition_attributes=None, tags=None, *, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) - - # Construct URL - url = self.update_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - 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 models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/__init__.py index 68ccf6d2e5f..cf378fc39e3 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/__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. # -------------------------------------------------------------------------- try: @@ -14,9 +11,6 @@ from ._models_py3 import AdministratorDetails from ._models_py3 import Attributes from ._models_py3 import BackupCertificateResult - from ._models_py3 import BackupKeyResult - from ._models_py3 import BackupSecretResult - from ._models_py3 import BackupStorageResult from ._models_py3 import CertificateAttributes from ._models_py3 import CertificateBundle from ._models_py3 import CertificateCreateParameters @@ -38,167 +32,67 @@ from ._models_py3 import DeletedCertificateBundle from ._models_py3 import DeletedCertificateItem from ._models_py3 import DeletedCertificateListResult - from ._models_py3 import DeletedKeyBundle - from ._models_py3 import DeletedKeyItem - from ._models_py3 import DeletedKeyListResult - from ._models_py3 import DeletedSasDefinitionBundle - from ._models_py3 import DeletedSasDefinitionItem - from ._models_py3 import DeletedSasDefinitionListResult - from ._models_py3 import DeletedSecretBundle - from ._models_py3 import DeletedSecretItem - from ._models_py3 import DeletedSecretListResult - from ._models_py3 import DeletedStorageAccountItem - from ._models_py3 import DeletedStorageBundle - from ._models_py3 import DeletedStorageListResult from ._models_py3 import Error from ._models_py3 import IssuerAttributes from ._models_py3 import IssuerBundle from ._models_py3 import IssuerCredentials from ._models_py3 import IssuerParameters - from ._models_py3 import JsonWebKey - from ._models_py3 import KeyAttributes - from ._models_py3 import KeyBundle - from ._models_py3 import KeyCreateParameters - from ._models_py3 import KeyImportParameters - from ._models_py3 import KeyItem - from ._models_py3 import KeyListResult - from ._models_py3 import KeyOperationResult - from ._models_py3 import KeyOperationsParameters from ._models_py3 import KeyProperties - from ._models_py3 import KeyRestoreParameters - from ._models_py3 import KeySignParameters - from ._models_py3 import KeyUpdateParameters - from ._models_py3 import KeyVaultError, KeyVaultErrorException - from ._models_py3 import KeyVerifyParameters - from ._models_py3 import KeyVerifyResult + from ._models_py3 import KeyVaultError from ._models_py3 import LifetimeAction from ._models_py3 import OrganizationDetails from ._models_py3 import PendingCertificateSigningRequestResult - from ._models_py3 import SasDefinitionAttributes - from ._models_py3 import SasDefinitionBundle - from ._models_py3 import SasDefinitionCreateParameters - from ._models_py3 import SasDefinitionItem - from ._models_py3 import SasDefinitionListResult - from ._models_py3 import SasDefinitionUpdateParameters - from ._models_py3 import SecretAttributes - from ._models_py3 import SecretBundle - from ._models_py3 import SecretItem - from ._models_py3 import SecretListResult from ._models_py3 import SecretProperties - from ._models_py3 import SecretRestoreParameters - from ._models_py3 import SecretSetParameters - from ._models_py3 import SecretUpdateParameters - from ._models_py3 import StorageAccountAttributes - from ._models_py3 import StorageAccountCreateParameters - from ._models_py3 import StorageAccountItem - from ._models_py3 import StorageAccountRegenerteKeyParameters - from ._models_py3 import StorageAccountUpdateParameters - from ._models_py3 import StorageBundle - from ._models_py3 import StorageListResult - from ._models_py3 import StorageRestoreParameters from ._models_py3 import SubjectAlternativeNames from ._models_py3 import Trigger from ._models_py3 import X509CertificateProperties except (SyntaxError, ImportError): - from ._models import Action - from ._models import AdministratorDetails - from ._models import Attributes - from ._models import BackupCertificateResult - from ._models import BackupKeyResult - from ._models import BackupSecretResult - from ._models import BackupStorageResult - from ._models import CertificateAttributes - from ._models import CertificateBundle - from ._models import CertificateCreateParameters - from ._models import CertificateImportParameters - from ._models import CertificateIssuerItem - from ._models import CertificateIssuerListResult - from ._models import CertificateIssuerSetParameters - from ._models import CertificateIssuerUpdateParameters - from ._models import CertificateItem - from ._models import CertificateListResult - from ._models import CertificateMergeParameters - from ._models import CertificateOperation - from ._models import CertificateOperationUpdateParameter - from ._models import CertificatePolicy - from ._models import CertificateRestoreParameters - from ._models import CertificateUpdateParameters - from ._models import Contact - from ._models import Contacts - from ._models import DeletedCertificateBundle - from ._models import DeletedCertificateItem - from ._models import DeletedCertificateListResult - from ._models import DeletedKeyBundle - from ._models import DeletedKeyItem - from ._models import DeletedKeyListResult - from ._models import DeletedSasDefinitionBundle - from ._models import DeletedSasDefinitionItem - from ._models import DeletedSasDefinitionListResult - from ._models import DeletedSecretBundle - from ._models import DeletedSecretItem - from ._models import DeletedSecretListResult - from ._models import DeletedStorageAccountItem - from ._models import DeletedStorageBundle - from ._models import DeletedStorageListResult - from ._models import Error - from ._models import IssuerAttributes - from ._models import IssuerBundle - from ._models import IssuerCredentials - from ._models import IssuerParameters - from ._models import JsonWebKey - from ._models import KeyAttributes - from ._models import KeyBundle - from ._models import KeyCreateParameters - from ._models import KeyImportParameters - from ._models import KeyItem - from ._models import KeyListResult - from ._models import KeyOperationResult - from ._models import KeyOperationsParameters - from ._models import KeyProperties - from ._models import KeyRestoreParameters - from ._models import KeySignParameters - from ._models import KeyUpdateParameters - from ._models import KeyVaultError, KeyVaultErrorException - from ._models import KeyVerifyParameters - from ._models import KeyVerifyResult - from ._models import LifetimeAction - from ._models import OrganizationDetails - from ._models import PendingCertificateSigningRequestResult - from ._models import SasDefinitionAttributes - from ._models import SasDefinitionBundle - from ._models import SasDefinitionCreateParameters - from ._models import SasDefinitionItem - from ._models import SasDefinitionListResult - from ._models import SasDefinitionUpdateParameters - from ._models import SecretAttributes - from ._models import SecretBundle - from ._models import SecretItem - from ._models import SecretListResult - from ._models import SecretProperties - from ._models import SecretRestoreParameters - from ._models import SecretSetParameters - from ._models import SecretUpdateParameters - from ._models import StorageAccountAttributes - from ._models import StorageAccountCreateParameters - from ._models import StorageAccountItem - from ._models import StorageAccountRegenerteKeyParameters - from ._models import StorageAccountUpdateParameters - from ._models import StorageBundle - from ._models import StorageListResult - from ._models import StorageRestoreParameters - from ._models import SubjectAlternativeNames - from ._models import Trigger - from ._models import X509CertificateProperties + from ._models import Action # type: ignore + from ._models import AdministratorDetails # type: ignore + from ._models import Attributes # type: ignore + from ._models import BackupCertificateResult # type: ignore + from ._models import CertificateAttributes # type: ignore + from ._models import CertificateBundle # type: ignore + from ._models import CertificateCreateParameters # type: ignore + from ._models import CertificateImportParameters # type: ignore + from ._models import CertificateIssuerItem # type: ignore + from ._models import CertificateIssuerListResult # type: ignore + from ._models import CertificateIssuerSetParameters # type: ignore + from ._models import CertificateIssuerUpdateParameters # type: ignore + from ._models import CertificateItem # type: ignore + from ._models import CertificateListResult # type: ignore + from ._models import CertificateMergeParameters # type: ignore + from ._models import CertificateOperation # type: ignore + from ._models import CertificateOperationUpdateParameter # type: ignore + from ._models import CertificatePolicy # type: ignore + from ._models import CertificateRestoreParameters # type: ignore + from ._models import CertificateUpdateParameters # type: ignore + from ._models import Contact # type: ignore + from ._models import Contacts # type: ignore + from ._models import DeletedCertificateBundle # type: ignore + from ._models import DeletedCertificateItem # type: ignore + from ._models import DeletedCertificateListResult # type: ignore + from ._models import Error # type: ignore + from ._models import IssuerAttributes # type: ignore + from ._models import IssuerBundle # type: ignore + from ._models import IssuerCredentials # type: ignore + from ._models import IssuerParameters # type: ignore + from ._models import KeyProperties # type: ignore + from ._models import KeyVaultError # type: ignore + from ._models import LifetimeAction # type: ignore + from ._models import OrganizationDetails # type: ignore + from ._models import PendingCertificateSigningRequestResult # type: ignore + from ._models import SecretProperties # type: ignore + from ._models import SubjectAlternativeNames # type: ignore + from ._models import Trigger # type: ignore + from ._models import X509CertificateProperties # type: ignore + from ._key_vault_client_enums import ( + ActionType, DeletionRecoveryLevel, - JsonWebKeyType, JsonWebKeyCurveName, + JsonWebKeyType, KeyUsageType, - ActionType, - JsonWebKeyOperation, - JsonWebKeyEncryptionAlgorithm, - JsonWebKeySignatureAlgorithm, - SasTokenType, ) __all__ = [ @@ -206,9 +100,6 @@ 'AdministratorDetails', 'Attributes', 'BackupCertificateResult', - 'BackupKeyResult', - 'BackupSecretResult', - 'BackupStorageResult', 'CertificateAttributes', 'CertificateBundle', 'CertificateCreateParameters', @@ -230,74 +121,23 @@ 'DeletedCertificateBundle', 'DeletedCertificateItem', 'DeletedCertificateListResult', - 'DeletedKeyBundle', - 'DeletedKeyItem', - 'DeletedKeyListResult', - 'DeletedSasDefinitionBundle', - 'DeletedSasDefinitionItem', - 'DeletedSasDefinitionListResult', - 'DeletedSecretBundle', - 'DeletedSecretItem', - 'DeletedSecretListResult', - 'DeletedStorageAccountItem', - 'DeletedStorageBundle', - 'DeletedStorageListResult', 'Error', 'IssuerAttributes', 'IssuerBundle', 'IssuerCredentials', 'IssuerParameters', - 'JsonWebKey', - 'KeyAttributes', - 'KeyBundle', - 'KeyCreateParameters', - 'KeyImportParameters', - 'KeyItem', - 'KeyListResult', - 'KeyOperationResult', - 'KeyOperationsParameters', 'KeyProperties', - 'KeyRestoreParameters', - 'KeySignParameters', - 'KeyUpdateParameters', - 'KeyVaultError', 'KeyVaultErrorException', - 'KeyVerifyParameters', - 'KeyVerifyResult', + 'KeyVaultError', 'LifetimeAction', 'OrganizationDetails', 'PendingCertificateSigningRequestResult', - 'SasDefinitionAttributes', - 'SasDefinitionBundle', - 'SasDefinitionCreateParameters', - 'SasDefinitionItem', - 'SasDefinitionListResult', - 'SasDefinitionUpdateParameters', - 'SecretAttributes', - 'SecretBundle', - 'SecretItem', - 'SecretListResult', 'SecretProperties', - 'SecretRestoreParameters', - 'SecretSetParameters', - 'SecretUpdateParameters', - 'StorageAccountAttributes', - 'StorageAccountCreateParameters', - 'StorageAccountItem', - 'StorageAccountRegenerteKeyParameters', - 'StorageAccountUpdateParameters', - 'StorageBundle', - 'StorageListResult', - 'StorageRestoreParameters', 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', + 'ActionType', 'DeletionRecoveryLevel', - 'JsonWebKeyType', 'JsonWebKeyCurveName', + 'JsonWebKeyType', 'KeyUsageType', - 'ActionType', - 'JsonWebKeyOperation', - 'JsonWebKeyEncryptionAlgorithm', - 'JsonWebKeySignatureAlgorithm', - 'SasTokenType', ] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_key_vault_client_enums.py index 936353e5bb8..ce04116e6b9 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_key_vault_client_enums.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_key_vault_client_enums.py @@ -1,18 +1,25 @@ # 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 ActionType(str, Enum): + """The type of the action. + """ + + email_contacts = "EmailContacts" + auto_renew = "AutoRenew" class DeletionRecoveryLevel(str, Enum): + """Reflects the deletion recovery level currently in effect for certificates in the current vault. + If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; + otherwise, only the system can purge the certificate, at the end of the retention interval. + """ purgeable = "Purgeable" recoverable_purgeable = "Recoverable+Purgeable" @@ -22,8 +29,18 @@ class DeletionRecoveryLevel(str, Enum): customized_recoverable = "CustomizedRecoverable" customized_recoverable_protected_subscription = "CustomizedRecoverable+ProtectedSubscription" +class JsonWebKeyCurveName(str, Enum): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + p256 = "P-256" + p384 = "P-384" + p521 = "P-521" + p256_k = "P-256K" class JsonWebKeyType(str, Enum): + """The type of key pair to be used for the certificate. + """ ec = "EC" ec_hsm = "EC-HSM" @@ -31,15 +48,6 @@ class JsonWebKeyType(str, Enum): rsa_hsm = "RSA-HSM" oct = "oct" - -class JsonWebKeyCurveName(str, Enum): - - p_256 = "P-256" - p_384 = "P-384" - p_521 = "P-521" - p_256_k = "P-256K" - - class KeyUsageType(str, Enum): digital_signature = "digitalSignature" @@ -51,48 +59,3 @@ class KeyUsageType(str, Enum): c_rl_sign = "cRLSign" encipher_only = "encipherOnly" decipher_only = "decipherOnly" - - -class ActionType(str, Enum): - - email_contacts = "EmailContacts" - auto_renew = "AutoRenew" - - -class JsonWebKeyOperation(str, Enum): - - encrypt = "encrypt" - decrypt = "decrypt" - sign = "sign" - verify = "verify" - wrap_key = "wrapKey" - unwrap_key = "unwrapKey" - import_enum = "import" - - -class JsonWebKeyEncryptionAlgorithm(str, Enum): - - rsa_oaep = "RSA-OAEP" - rsa_oaep_256 = "RSA-OAEP-256" - rsa1_5 = "RSA1_5" - - -class JsonWebKeySignatureAlgorithm(str, Enum): - - ps256 = "PS256" #: RSASSA-PSS using SHA-256 and MGF1 with SHA-256, as described in https://tools.ietf.org/html/rfc7518 - ps384 = "PS384" #: RSASSA-PSS using SHA-384 and MGF1 with SHA-384, as described in https://tools.ietf.org/html/rfc7518 - ps512 = "PS512" #: RSASSA-PSS using SHA-512 and MGF1 with SHA-512, as described in https://tools.ietf.org/html/rfc7518 - rs256 = "RS256" #: RSASSA-PKCS1-v1_5 using SHA-256, as described in https://tools.ietf.org/html/rfc7518 - rs384 = "RS384" #: RSASSA-PKCS1-v1_5 using SHA-384, as described in https://tools.ietf.org/html/rfc7518 - rs512 = "RS512" #: RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 - rsnull = "RSNULL" #: Reserved - es256 = "ES256" #: ECDSA using P-256 and SHA-256, as described in https://tools.ietf.org/html/rfc7518. - es384 = "ES384" #: ECDSA using P-384 and SHA-384, as described in https://tools.ietf.org/html/rfc7518 - es512 = "ES512" #: ECDSA using P-521 and SHA-512, as described in https://tools.ietf.org/html/rfc7518 - es256_k = "ES256K" #: ECDSA using P-256K and SHA-256, as described in https://tools.ietf.org/html/rfc7518 - - -class SasTokenType(str, Enum): - - account = "account" - service = "service" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models.py index ea5379c44cc..3c159aee5c4 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models.py @@ -1,36 +1,36 @@ # 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 azure.core.exceptions import HttpResponseError +import msrest.serialization -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v7_1.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = kwargs.get('action_type', None) -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +50,10 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = kwargs.get('first_name', None) self.last_name = kwargs.get('last_name', None) @@ -58,22 +61,21 @@ def __init__(self, **kwargs): self.phone = kwargs.get('phone', None) -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +91,10 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -98,11 +103,10 @@ def __init__(self, **kwargs): self.updated = None -class BackupCertificateResult(Model): +class BackupCertificateResult(msrest.serialization.Model): """The backup certificate result, containing the backup blob. - 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 value: The backup blob containing the backed up certificate. :vartype value: bytes @@ -116,109 +120,39 @@ class BackupCertificateResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(BackupCertificateResult, self).__init__(**kwargs) self.value = None -class BackupKeyResult(Model): - """The backup key result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up key. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(BackupKeyResult, self).__init__(**kwargs) - self.value = None - - -class BackupSecretResult(Model): - """The backup secret result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up secret. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(BackupSecretResult, self).__init__(**kwargs) - self.value = None - - -class BackupStorageResult(Model): - """The backup storage result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up storage account. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(BackupStorageResult, self).__init__(**kwargs) - self.value = None - - class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. + :vartype updated: ~datetime.datetime + :ivar recoverable_days: softDelete data retention days. Value should be >=7 and <=90 when + softDelete enabled, otherwise 0. :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_1.models.DeletionRecoveryLevel """ _validation = { @@ -238,17 +172,19 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateAttributes, self).__init__(**kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -266,7 +202,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -290,7 +226,10 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -303,16 +242,14 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -322,32 +259,32 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -363,16 +300,19 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) - self.base64_encoded_certificate = kwargs.get('base64_encoded_certificate', None) + self.base64_encoded_certificate = kwargs['base64_encoded_certificate'] self.password = kwargs.get('password', None) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -386,21 +326,22 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.provider = kwargs.get('provider', None) -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. :vartype value: list[~azure.keyvault.v7_1.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str @@ -416,13 +357,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -431,10 +375,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ @@ -450,25 +392,26 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) + self.provider = kwargs['provider'] self.credentials = kwargs.get('credentials', None) self.organization_details = kwargs.get('organization_details', None) self.attributes = kwargs.get('attributes', None) -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ @@ -480,7 +423,10 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = kwargs.get('provider', None) self.credentials = kwargs.get('credentials', None) @@ -488,14 +434,14 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -508,7 +454,10 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = kwargs.get('id', None) self.attributes = kwargs.get('attributes', None) @@ -516,14 +465,13 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v7_1.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -539,25 +487,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -571,29 +519,30 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) - self.x509_certificates = kwargs.get('x509_certificates', None) + self.x509_certificates = kwargs['x509_certificates'] self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -601,8 +550,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v7_1.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -624,7 +572,10 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = kwargs.get('issuer_parameters', None) @@ -637,13 +588,13 @@ def __init__(self, **kwargs): self.request_id = kwargs.get('request_id', None) -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -655,16 +606,18 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) - self.cancellation_requested = kwargs.get('cancellation_requested', None) + self.cancellation_requested = kwargs['cancellation_requested'] -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str @@ -672,15 +625,12 @@ class CertificatePolicy(Model): :type key_properties: ~azure.keyvault.v7_1.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. :type secret_properties: ~azure.keyvault.v7_1.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v7_1.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. :type lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes @@ -700,7 +650,10 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = kwargs.get('key_properties', None) @@ -711,13 +664,13 @@ def __init__(self, **kwargs): self.attributes = kwargs.get('attributes', None) -class CertificateRestoreParameters(Model): +class CertificateRestoreParameters(msrest.serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :param certificate_bundle_backup: Required. The backup blob associated - with a certificate bundle. + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. :type certificate_bundle_backup: bytes """ @@ -729,21 +682,22 @@ class CertificateRestoreParameters(Model): 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateRestoreParameters, self).__init__(**kwargs) - self.certificate_bundle_backup = kwargs.get('certificate_bundle_backup', None) + self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -753,14 +707,17 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = kwargs.get('certificate_policy', None) self.certificate_attributes = kwargs.get('certificate_attributes', None) self.tags = kwargs.get('tags', None) -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -777,18 +734,20 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = kwargs.get('email_address', None) self.name = kwargs.get('name', None) self.phone = kwargs.get('phone', None) -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -805,18 +764,19 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = kwargs.get('contact_list', None) class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -834,16 +794,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -871,7 +830,10 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None @@ -879,28 +841,25 @@ def __init__(self, **kwargs): class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -918,21 +877,23 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateItem, self).__init__(**kwargs) self.recovery_id = kwargs.get('recovery_id', None) self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. :vartype value: list[~azure.keyvault.v7_1.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str @@ -948,1908 +909,312 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): - """A KeyBundle consisting of a WebKey plus its attributes. +class Error(msrest.serialization.Model): + """The key vault server error. - 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. - :param key: The Json web key. - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The key vault server error. + :vartype inner_error: ~azure.keyvault.v7_1.models.Error """ _validation = { - 'managed': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, **kwargs): - super(KeyBundle, self).__init__(**kwargs) - self.key = kwargs.get('key', None) - self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) - self.managed = None + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None -class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. +class IssuerAttributes(msrest.serialization.Model): + """The attributes of an issuer managed by the Key Vault service. - 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. - :param key: The Json web key. - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :param enabled: Determines whether the issuer is enabled. + :type enabled: bool + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, **kwargs): - super(DeletedKeyBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None + def __init__( + self, + **kwargs + ): + super(IssuerAttributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.created = None + self.updated = None -class KeyItem(Model): - """The key item containing key metadata. +class IssuerBundle(msrest.serialization.Model): + """The issuer for Key Vault certificate. - 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. - :param kid: Key identifier. - :type kid: str - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool + :ivar id: Identifier for the issuer object. + :vartype id: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ _validation = { - 'managed': {'readonly': True}, + 'id': {'readonly': True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, **kwargs): - super(KeyItem, self).__init__(**kwargs) - self.kid = kwargs.get('kid', None) + def __init__( + self, + **kwargs + ): + super(IssuerBundle, self).__init__(**kwargs) + self.id = None + self.provider = kwargs.get('provider', None) + self.credentials = kwargs.get('credentials', None) + self.organization_details = kwargs.get('organization_details', None) self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) - self.managed = None - -class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. - Variables are only populated by the server, and will be ignored when - sending a request. +class IssuerCredentials(msrest.serialization.Model): + """The credentials to be used for the certificate issuer. - :param kid: Key identifier. - :type kid: str - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :param account_id: The user name/account name/account id. + :type account_id: str + :param password: The password/secret/account key. + :type password: str """ - _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'account_id': {'key': 'account_id', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, **kwargs): - super(DeletedKeyItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - + def __init__( + self, + **kwargs + ): + super(IssuerCredentials, self).__init__(**kwargs) + self.account_id = kwargs.get('account_id', None) + self.password = kwargs.get('password', None) -class DeletedKeyListResult(Model): - """A list of keys that have been deleted in this vault. - Variables are only populated by the server, and will be ignored when - sending a request. +class IssuerParameters(msrest.serialization.Model): + """Parameters for the issuer of the X509 component of a certificate. - :ivar value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys - :vartype value: list[~azure.keyvault.v7_1.models.DeletedKeyItem] - :ivar next_link: The URL to get the next set of deleted keys. - :vartype next_link: str + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. + :type name: str + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. + :type certificate_type: str + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. + :type certificate_transparency: bool """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'certificate_type': {'key': 'cty', 'type': 'str'}, + 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, } - def __init__(self, **kwargs): - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - + def __init__( + self, + **kwargs + ): + super(IssuerParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.certificate_type = kwargs.get('certificate_type', None) + self.certificate_transparency = kwargs.get('certificate_transparency', None) -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. - Variables are only populated by the server, and will be ignored when - sending a request. +class KeyProperties(msrest.serialization.Model): + """Properties of the key pair backing a certificate. - :ivar id: The SAS definition id. - :vartype id: str - :ivar secret_id: Storage account SAS definition secret id. - :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :vartype sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. - :vartype validity_period: str - :ivar attributes: The SAS definition attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :type key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. + :type reuse_key: bool + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". + :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'template_uri': {'readonly': True}, - 'sas_type': {'readonly': True}, - 'validity_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'exportable': {'key': 'exportable', 'type': 'bool'}, + 'key_type': {'key': 'kty', 'type': 'str'}, + 'key_size': {'key': 'key_size', 'type': 'int'}, + 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, + 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, **kwargs): - super(SasDefinitionBundle, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.template_uri = None - self.sas_type = None - self.validity_period = None - self.attributes = None - self.tags = None + def __init__( + self, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.exportable = kwargs.get('exportable', None) + self.key_type = kwargs.get('key_type', None) + self.key_size = kwargs.get('key_size', None) + self.reuse_key = kwargs.get('reuse_key', None) + self.curve = kwargs.get('curve', None) -class DeletedSasDefinitionBundle(SasDefinitionBundle): - """A deleted SAS definition bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. +class KeyVaultError(msrest.serialization.Model): + """The key vault error exception. - 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 SAS definition id. - :vartype id: str - :ivar secret_id: Storage account SAS definition secret id. - :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :vartype sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. - :vartype validity_period: str - :ivar attributes: The SAS definition attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar error: The key vault server error. + :vartype error: ~azure.keyvault.v7_1.models.Error """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'template_uri': {'readonly': True}, - 'sas_type': {'readonly': True}, - 'validity_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'error': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, **kwargs): - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - + def __init__( + self, + **kwargs + ): + super(KeyVaultError, self).__init__(**kwargs) + self.error = None -class SasDefinitionItem(Model): - """The SAS definition item containing storage SAS definition metadata. - Variables are only populated by the server, and will be ignored when - sending a request. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - :ivar id: The storage SAS identifier. - :vartype id: str - :ivar secret_id: The storage account SAS definition secret id. - :vartype secret_id: str - :ivar attributes: The SAS definition management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + :param trigger: The condition that will execute the action. + :type trigger: ~azure.keyvault.v7_1.models.Trigger + :param action: The action that will be executed. + :type action: ~azure.keyvault.v7_1.models.Action """ - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, } + def __init__( + self, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = kwargs.get('trigger', None) + self.action = kwargs.get('action', None) + + +class OrganizationDetails(msrest.serialization.Model): + """Details of the organization of the certificate issuer. + + :param id: Id of the organization. + :type id: str + :param admin_details: Details of the organization administrator. + :type admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] + """ + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, **kwargs): - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None + def __init__( + self, + **kwargs + ): + super(OrganizationDetails, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.admin_details = kwargs.get('admin_details', None) -class DeletedSasDefinitionItem(SasDefinitionItem): - """The deleted SAS definition item containing metadata about the deleted SAS - definition. +class PendingCertificateSigningRequestResult(msrest.serialization.Model): + """The pending certificate signing request result. - 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 storage SAS identifier. - :vartype id: str - :ivar secret_id: The storage account SAS definition secret id. - :vartype secret_id: str - :ivar attributes: The SAS definition management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar value: The pending certificate signing request as Base64 encoded string. + :vartype value: str """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(DeletedSasDefinitionItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedSasDefinitionListResult(Model): - """The deleted SAS definition list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted SAS - definitions in the vault along with a link to the next page of deleted sas - definitions - :vartype value: list[~azure.keyvault.v7_1.models.DeletedSasDefinitionItem] - :ivar next_link: The URL to get the next set of deleted SAS definitions. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DeletedSasDefinitionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretBundle(Model): - """A secret consisting of a value, id and its attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param value: The secret value. - :type value: str - :param id: The secret id. - :type id: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. - :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. - :vartype managed: bool - """ - - _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kid': {'key': 'kid', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(SecretBundle, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.id = kwargs.get('id', None) - self.content_type = kwargs.get('content_type', None) - self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) - self.kid = None - self.managed = None - - -class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param value: The secret value. - :type value: str - :param id: The secret id. - :type id: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. - :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kid': {'key': 'kid', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(DeletedSecretBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -class SecretItem(Model): - """The secret item containing secret metadata. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Secret identifier. - :type id: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. - :vartype managed: bool - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(SecretItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.attributes = kwargs.get('attributes', None) - self.tags = kwargs.get('tags', None) - self.content_type = kwargs.get('content_type', None) - self.managed = None - - -class DeletedSecretItem(SecretItem): - """The deleted secret item containing metadata about the deleted secret. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Secret identifier. - :type id: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(DeletedSecretItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedSecretListResult(Model): - """The deleted secret list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets - :vartype value: list[~azure.keyvault.v7_1.models.DeletedSecretItem] - :ivar next_link: The URL to get the next set of deleted secrets. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DeletedSecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountItem(Model): - """The storage account item containing storage account metadata. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Storage identifier. - :vartype id: str - :ivar resource_id: Storage account resource Id. - :vartype resource_id: str - :ivar attributes: The storage account management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(StorageAccountItem, self).__init__(**kwargs) - self.id = None - self.resource_id = None - self.attributes = None - self.tags = None - - -class DeletedStorageAccountItem(StorageAccountItem): - """The deleted storage account item containing metadata about the deleted - storage account. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Storage identifier. - :vartype id: str - :ivar resource_id: Storage account resource Id. - :vartype resource_id: str - :ivar attributes: The storage account management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(DeletedStorageAccountItem, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The storage account id. - :vartype id: str - :ivar resource_id: The storage account resource id. - :vartype resource_id: str - :ivar active_key_name: The current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. - :vartype regeneration_period: str - :ivar attributes: The storage account attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'active_key_name': {'readonly': True}, - 'auto_regenerate_key': {'readonly': True}, - 'regeneration_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(StorageBundle, self).__init__(**kwargs) - self.id = None - self.resource_id = None - self.active_key_name = None - self.auto_regenerate_key = None - self.regeneration_period = None - self.attributes = None - self.tags = None - - -class DeletedStorageBundle(StorageBundle): - """A deleted storage account bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The storage account id. - :vartype id: str - :ivar resource_id: The storage account resource id. - :vartype resource_id: str - :ivar active_key_name: The current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. - :vartype regeneration_period: str - :ivar attributes: The storage account attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'active_key_name': {'readonly': True}, - 'auto_regenerate_key': {'readonly': True}, - 'regeneration_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(DeletedStorageBundle, self).__init__(**kwargs) - self.recovery_id = kwargs.get('recovery_id', None) - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedStorageListResult(Model): - """The deleted storage account list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted storage - accounts in the vault along with a link to the next page of deleted - storage accounts - :vartype value: - list[~azure.keyvault.v7_1.models.DeletedStorageAccountItem] - :ivar next_link: The URL to get the next set of deleted storage accounts. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(DeletedStorageListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Error(Model): - """The key vault server error. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar inner_error: - :vartype inner_error: ~azure.keyvault.v7_1.models.Error - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_error': {'key': 'innererror', 'type': 'Error'}, - } - - def __init__(self, **kwargs): - super(Error, self).__init__(**kwargs) - self.code = None - self.message = None - self.inner_error = None - - -class IssuerAttributes(Model): - """The attributes of an issuer managed by the Key Vault service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the issuer is enabled. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__(self, **kwargs): - super(IssuerAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - - -class IssuerBundle(Model): - """The issuer for Key Vault certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Identifier for the issuer object. - :vartype id: str - :param provider: The issuer provider. - :type provider: str - :param credentials: The credentials to be used for the issuer. - :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails - :param attributes: Attributes of the issuer object. - :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, - } - - def __init__(self, **kwargs): - super(IssuerBundle, self).__init__(**kwargs) - self.id = None - self.provider = kwargs.get('provider', None) - self.credentials = kwargs.get('credentials', None) - self.organization_details = kwargs.get('organization_details', None) - self.attributes = kwargs.get('attributes', None) - - -class IssuerCredentials(Model): - """The credentials to be used for the certificate issuer. - - :param account_id: The user name/account name/account id. - :type account_id: str - :param password: The password/secret/account key. - :type password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(IssuerCredentials, self).__init__(**kwargs) - self.account_id = kwargs.get('account_id', None) - self.password = kwargs.get('password', None) - - -class IssuerParameters(Model): - """Parameters for the issuer of the X509 component of a certificate. - - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. - :type name: str - :param certificate_type: Certificate type as supported by the provider - (optional); for example 'OV-SSL', 'EV-SSL' - :type certificate_type: str - :param certificate_transparency: Indicates if the certificates generated - under this policy should be published to certificate transparency logs. - :type certificate_transparency: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(IssuerParameters, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.certificate_type = kwargs.get('certificate_type', None) - self.certificate_transparency = kwargs.get('certificate_transparency', None) - - -class JsonWebKey(Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :param kid: Key identifier. - :type kid: str - :param kty: JsonWebKey Key Type (kty), as defined in - https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str] - :param n: RSA modulus. - :type n: bytes - :param e: RSA public exponent. - :type e: bytes - :param d: RSA private exponent, or the D component of an EC private key. - :type d: bytes - :param dp: RSA private key parameter. - :type dp: bytes - :param dq: RSA private key parameter. - :type dq: bytes - :param qi: RSA private key parameter. - :type qi: bytes - :param p: RSA secret prime. - :type p: bytes - :param q: RSA secret prime, with p < q. - :type q: bytes - :param k: Symmetric key. - :type k: bytes - :param t: HSM Token, used with 'Bring Your Own Key'. - :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :param x: X component of an EC public key. - :type x: bytes - :param y: Y component of an EC public key. - :type y: bytes - """ - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'n': {'key': 'n', 'type': 'base64'}, - 'e': {'key': 'e', 'type': 'base64'}, - 'd': {'key': 'd', 'type': 'base64'}, - 'dp': {'key': 'dp', 'type': 'base64'}, - 'dq': {'key': 'dq', 'type': 'base64'}, - 'qi': {'key': 'qi', 'type': 'base64'}, - 'p': {'key': 'p', 'type': 'base64'}, - 'q': {'key': 'q', 'type': 'base64'}, - 'k': {'key': 'k', 'type': 'base64'}, - 't': {'key': 'key_hsm', 'type': 'base64'}, - 'crv': {'key': 'crv', 'type': 'str'}, - 'x': {'key': 'x', 'type': 'base64'}, - 'y': {'key': 'y', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(JsonWebKey, self).__init__(**kwargs) - self.kid = kwargs.get('kid', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.n = kwargs.get('n', None) - self.e = kwargs.get('e', None) - self.d = kwargs.get('d', None) - self.dp = kwargs.get('dp', None) - self.dq = kwargs.get('dq', None) - self.qi = kwargs.get('qi', None) - self.p = kwargs.get('p', None) - self.q = kwargs.get('q', None) - self.k = kwargs.get('k', None) - self.t = kwargs.get('t', None) - self.crv = kwargs.get('crv', None) - self.x = kwargs.get('x', None) - self.y = kwargs.get('y', None) - - -class KeyAttributes(Attributes): - """The attributes of a key managed by the key vault service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in UTC. - :type not_before: datetime - :param expires: Expiry date in UTC. - :type expires: datetime - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class KeyCreateParameters(Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. - :type key_size: int - :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'curve': {'key': 'crv', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kwargs.get('kty', None) - self.key_size = kwargs.get('key_size', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - self.curve = kwargs.get('curve', None) - - -class KeyImportParameters(Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :param hsm: Whether to import as a hardware key (HSM) or software key. - :type hsm: bool - :param key: Required. The Json web key - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param key_attributes: The key management attributes. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'key': {'required': True}, - } - - _attribute_map = { - 'hsm': {'key': 'Hsm', 'type': 'bool'}, - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = kwargs.get('hsm', None) - self.key = kwargs.get('key', None) - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyListResult(Model): - """The key list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. - :vartype value: list[~azure.keyvault.v7_1.models.KeyItem] - :ivar next_link: The URL to get the next set of keys. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class KeyOperationResult(Model): - """The key operation result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar kid: Key identifier - :vartype kid: str - :ivar result: - :vartype result: bytes - """ - - _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(KeyOperationResult, self).__init__(**kwargs) - self.kid = None - self.result = None - - -class KeyOperationsParameters(Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: Required. - :type value: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) - - -class KeyProperties(Model): - """Properties of the key pair backing a certificate. - - :param exportable: Indicates if the private key can be exported. - :type exportable: bool - :param key_type: The type of key pair to be used for the certificate. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' - :type key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. - :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. - :type reuse_key: bool - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - - _attribute_map = { - 'exportable': {'key': 'exportable', 'type': 'bool'}, - 'key_type': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, - 'curve': {'key': 'crv', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(KeyProperties, self).__init__(**kwargs) - self.exportable = kwargs.get('exportable', None) - self.key_type = kwargs.get('key_type', None) - self.key_size = kwargs.get('key_size', None) - self.reuse_key = kwargs.get('reuse_key', None) - self.curve = kwargs.get('curve', None) - - -class KeyRestoreParameters(Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. - :type key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = kwargs.get('key_bundle_backup', None) - - -class KeySignParameters(Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param value: Required. - :type value: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.value = kwargs.get('value', None) - - -class KeyUpdateParameters(Model): - """The key update parameters. - - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(KeyUpdateParameters, self).__init__(**kwargs) - self.key_ops = kwargs.get('key_ops', None) - self.key_attributes = kwargs.get('key_attributes', None) - self.tags = kwargs.get('tags', None) - - -class KeyVaultError(Model): - """The key vault error exception. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar error: - :vartype error: ~azure.keyvault.v7_1.models.Error - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__(self, **kwargs): - super(KeyVaultError, self).__init__(**kwargs) - self.error = None - - -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param digest: Required. The digest used for signing. - :type digest: bytes - :param signature: Required. The signature to be verified. - :type signature: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'digest': {'required': True}, - 'signature': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = kwargs.get('algorithm', None) - self.digest = kwargs.get('digest', None) - self.signature = kwargs.get('signature', None) - - -class KeyVerifyResult(Model): - """The key verify result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: True if the signature is verified, otherwise false. - :vartype value: bool - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, - } - - def __init__(self, **kwargs): - super(KeyVerifyResult, self).__init__(**kwargs) - self.value = None - - -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. - - :param trigger: The condition that will execute the action. - :type trigger: ~azure.keyvault.v7_1.models.Trigger - :param action: The action that will be executed. - :type action: ~azure.keyvault.v7_1.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__(self, **kwargs): - super(LifetimeAction, self).__init__(**kwargs) - self.trigger = kwargs.get('trigger', None) - self.action = kwargs.get('action', None) - - -class OrganizationDetails(Model): - """Details of the organization of the certificate issuer. - - :param id: Id of the organization. - :type id: str - :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v7_1.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__(self, **kwargs): - super(OrganizationDetails, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.admin_details = kwargs.get('admin_details', None) - - -class PendingCertificateSigningRequestResult(Model): - """The pending certificate signing request result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The pending certificate signing request as Base64 encoded - string. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) - self.value = None - - -class SasDefinitionAttributes(Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: the enabled state of the object. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for SAS definitions in the current vault. If it contains - 'Purgeable' the SAS definition can be permanently deleted by a privileged - user; otherwise, only the system can purge the SAS definition, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recoverable_days = None - self.recovery_level = None - - -class SasDefinitionCreateParameters(Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :param template_uri: Required. The SAS definition token template signed - with an arbitrary key. Tokens created according to the SAS definition - will have the same properties as the template. - :type template_uri: str - :param sas_type: Required. The type of SAS token the SAS definition will - create. Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: Required. The validity period of SAS tokens - created according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'template_uri': {'required': True}, - 'sas_type': {'required': True}, - 'validity_period': {'required': True}, - } - - _attribute_map = { - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.template_uri = kwargs.get('template_uri', None) - self.sas_type = kwargs.get('sas_type', None) - self.validity_period = kwargs.get('validity_period', None) - self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) - self.tags = kwargs.get('tags', None) - - -class SasDefinitionListResult(Model): - """The storage account SAS definition list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. - :vartype value: list[~azure.keyvault.v7_1.models.SasDefinitionItem] - :ivar next_link: The URL to get the next set of SAS definitions. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SasDefinitionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SasDefinitionUpdateParameters(Model): - """The SAS definition update parameters. - - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) - self.template_uri = kwargs.get('template_uri', None) - self.sas_type = kwargs.get('sas_type', None) - self.validity_period = kwargs.get('validity_period', None) - self.sas_definition_attributes = kwargs.get('sas_definition_attributes', None) - self.tags = kwargs.get('tags', None) - - -class SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in UTC. - :type not_before: datetime - :param expires: Expiry date in UTC. - :type expires: datetime - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription', - 'CustomizedRecoverable+Purgeable', 'CustomizedRecoverable', - 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(SecretAttributes, self).__init__(**kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class SecretListResult(Model): - """The secret list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. - :vartype value: list[~azure.keyvault.v7_1.models.SecretItem] - :ivar next_link: The URL to get the next set of secrets. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs): - super(SecretListResult, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None - self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2860,300 +1225,15 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = kwargs.get('content_type', None) -class SecretRestoreParameters(Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. - :type secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = kwargs.get('secret_bundle_backup', None) - - -class SecretSetParameters(Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - } - - def __init__(self, **kwargs): - super(SecretSetParameters, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.tags = kwargs.get('tags', None) - self.content_type = kwargs.get('content_type', None) - self.secret_attributes = kwargs.get('secret_attributes', None) - - -class SecretUpdateParameters(Model): - """The secret update parameters. - - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(SecretUpdateParameters, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', None) - self.secret_attributes = kwargs.get('secret_attributes', None) - self.tags = kwargs.get('tags', None) - - -class StorageAccountAttributes(Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: the enabled state of the object. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for storage accounts in the current vault. If it contains - 'Purgeable' the storage account can be permanently deleted by a privileged - user; otherwise, only the system can purge the storage account, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.created = None - self.updated = None - self.recoverable_days = None - self.recovery_level = None - - -class StorageAccountCreateParameters(Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: Required. Storage account resource id. - :type resource_id: str - :param active_key_name: Required. Current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'storage_account_attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.resource_id = kwargs.get('resource_id', None) - self.active_key_name = kwargs.get('active_key_name', None) - self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) - self.regeneration_period = kwargs.get('regeneration_period', None) - self.storage_account_attributes = kwargs.get('storage_account_attributes', None) - self.tags = kwargs.get('tags', None) - - -class StorageAccountRegenerteKeyParameters(Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The storage account key name. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - - -class StorageAccountUpdateParameters(Model): - """The storage account update parameters. - - :param active_key_name: The current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'storage_account_attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs): - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.active_key_name = kwargs.get('active_key_name', None) - self.auto_regenerate_key = kwargs.get('auto_regenerate_key', None) - self.regeneration_period = kwargs.get('regeneration_period', None) - self.storage_account_attributes = kwargs.get('storage_account_attributes', None) - self.tags = kwargs.get('tags', None) - - -class StorageListResult(Model): - """The storage accounts list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. - :vartype value: list[~azure.keyvault.v7_1.models.StorageAccountItem] - :ivar next_link: The URL to get the next set of storage accounts. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(StorageListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageRestoreParameters(Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param storage_bundle_backup: Required. The backup blob associated with a - storage account. - :type storage_bundle_backup: bytes - """ - - _validation = { - 'storage_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs): - super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = kwargs.get('storage_bundle_backup', None) - - -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -3170,23 +1250,25 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = kwargs.get('emails', None) self.dns_names = kwargs.get('dns_names', None) self.upns = kwargs.get('upns', None) -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -3199,27 +1281,27 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = kwargs.get('lifetime_percentage', None) self.days_before_expiry = kwargs.get('days_before_expiry', None) -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v7_1.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames :param key_usage: List of key usages. :type key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -3235,7 +1317,10 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, **kwargs): + def __init__( + self, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = kwargs.get('subject', None) self.ekus = kwargs.get('ekus', None) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models_py3.py index b57835037d8..65af2853a52 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/models/_models_py3.py @@ -1,36 +1,43 @@ # 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 datetime +from typing import Dict, List, Optional, Union + from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._key_vault_client_enums import * -class Action(Model): +class Action(msrest.serialization.Model): """The action that will be executed. - :param action_type: The type of the action. Possible values include: - 'EmailContacts', 'AutoRenew' + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". :type action_type: str or ~azure.keyvault.v7_1.models.ActionType """ _attribute_map = { - 'action_type': {'key': 'action_type', 'type': 'ActionType'}, + 'action_type': {'key': 'action_type', 'type': 'str'}, } - def __init__(self, *, action_type=None, **kwargs) -> None: + def __init__( + self, + *, + action_type: Optional[Union[str, "ActionType"]] = None, + **kwargs + ): super(Action, self).__init__(**kwargs) self.action_type = action_type -class AdministratorDetails(Model): +class AdministratorDetails(msrest.serialization.Model): """Details of the organization administrator of the certificate issuer. :param first_name: First name. @@ -50,7 +57,15 @@ class AdministratorDetails(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, first_name: str=None, last_name: str=None, email_address: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(AdministratorDetails, self).__init__(**kwargs) self.first_name = first_name self.last_name = last_name @@ -58,22 +73,21 @@ def __init__(self, *, first_name: str=None, last_name: str=None, email_address: self.phone = phone -class Attributes(Model): +class Attributes(msrest.serialization.Model): """The object attributes managed by the KeyVault service. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime + :vartype updated: ~datetime.datetime """ _validation = { @@ -89,7 +103,14 @@ class Attributes(Model): 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -98,11 +119,10 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.updated = None -class BackupCertificateResult(Model): +class BackupCertificateResult(msrest.serialization.Model): """The backup certificate result, containing the backup blob. - 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 value: The backup blob containing the backed up certificate. :vartype value: bytes @@ -116,109 +136,39 @@ class BackupCertificateResult(Model): 'value': {'key': 'value', 'type': 'base64'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(BackupCertificateResult, self).__init__(**kwargs) self.value = None -class BackupKeyResult(Model): - """The backup key result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up key. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs) -> None: - super(BackupKeyResult, self).__init__(**kwargs) - self.value = None - - -class BackupSecretResult(Model): - """The backup secret result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up secret. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs) -> None: - super(BackupSecretResult, self).__init__(**kwargs) - self.value = None - - -class BackupStorageResult(Model): - """The backup storage result, containing the backup blob. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The backup blob containing the backed up storage account. - :vartype value: bytes - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs) -> None: - super(BackupStorageResult, self).__init__(**kwargs) - self.value = None - - class CertificateAttributes(Attributes): """The certificate management attributes. - 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. :param enabled: Determines whether the object is enabled. :type enabled: bool :param not_before: Not before date in UTC. - :type not_before: datetime + :type not_before: ~datetime.datetime :param expires: Expiry date in UTC. - :type expires: datetime + :type expires: ~datetime.datetime :ivar created: Creation time in UTC. - :vartype created: datetime + :vartype created: ~datetime.datetime :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. + :vartype updated: ~datetime.datetime + :ivar recoverable_days: softDelete data retention days. Value should be >=7 and <=90 when + softDelete enabled, otherwise 0. :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for certificates in the current vault. If it contains 'Purgeable', - the certificate can be permanently deleted by a privileged user; - otherwise, only the system can purge the certificate, at the end of the - retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_1.models.DeletionRecoveryLevel """ _validation = { @@ -238,17 +188,23 @@ class CertificateAttributes(Attributes): 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, } - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) self.recoverable_days = None self.recovery_level = None -class CertificateBundle(Model): +class CertificateBundle(msrest.serialization.Model): """A certificate bundle consists of a certificate (X509) plus its attributes. - 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 certificate id. :vartype id: str @@ -266,7 +222,7 @@ class CertificateBundle(Model): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -290,7 +246,15 @@ class CertificateBundle(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateBundle, self).__init__(**kwargs) self.id = None self.kid = None @@ -303,16 +267,14 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No self.tags = tags -class CertificateCreateParameters(Model): +class CertificateCreateParameters(msrest.serialization.Model): """The certificate create parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -322,32 +284,36 @@ class CertificateCreateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateCreateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateImportParameters(Model): +class CertificateImportParameters(msrest.serialization.Model): """The certificate import parameters. All required parameters must be populated in order to send to Azure. - :param base64_encoded_certificate: Required. Base64 encoded representation - of the certificate object to import. This certificate needs to contain the - private key. + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -363,7 +329,16 @@ class CertificateImportParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, base64_encoded_certificate: str, password: str=None, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateImportParameters, self).__init__(**kwargs) self.base64_encoded_certificate = base64_encoded_certificate self.password = password @@ -372,7 +347,7 @@ def __init__(self, *, base64_encoded_certificate: str, password: str=None, certi self.tags = tags -class CertificateIssuerItem(Model): +class CertificateIssuerItem(msrest.serialization.Model): """The certificate issuer item containing certificate issuer metadata. :param id: Certificate Identifier. @@ -386,21 +361,25 @@ class CertificateIssuerItem(Model): 'provider': {'key': 'provider', 'type': 'str'}, } - def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + provider: Optional[str] = None, + **kwargs + ): super(CertificateIssuerItem, self).__init__(**kwargs) self.id = id self.provider = provider -class CertificateIssuerListResult(Model): +class CertificateIssuerListResult(msrest.serialization.Model): """The certificate issuer list result. - 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 value: A response message containing a list of certificate issuers - in the key vault along with a link to the next page of certificate - issuers. + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. :vartype value: list[~azure.keyvault.v7_1.models.CertificateIssuerItem] :ivar next_link: The URL to get the next set of certificate issuers. :vartype next_link: str @@ -416,13 +395,16 @@ class CertificateIssuerListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateIssuerListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateIssuerSetParameters(Model): +class CertificateIssuerSetParameters(msrest.serialization.Model): """The certificate issuer set parameters. All required parameters must be populated in order to send to Azure. @@ -431,10 +413,8 @@ class CertificateIssuerSetParameters(Model): :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ @@ -450,7 +430,15 @@ class CertificateIssuerSetParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: str, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerSetParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -458,17 +446,15 @@ def __init__(self, *, provider: str, credentials=None, organization_details=None self.attributes = attributes -class CertificateIssuerUpdateParameters(Model): +class CertificateIssuerUpdateParameters(msrest.serialization.Model): """The certificate issuer update parameters. :param provider: The issuer provider. :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ @@ -480,7 +466,15 @@ class CertificateIssuerUpdateParameters(Model): 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) self.provider = provider self.credentials = credentials @@ -488,14 +482,14 @@ def __init__(self, *, provider: str=None, credentials=None, organization_details self.attributes = attributes -class CertificateItem(Model): +class CertificateItem(msrest.serialization.Model): """The certificate item containing certificate metadata. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes @@ -508,7 +502,15 @@ class CertificateItem(Model): 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + **kwargs + ): super(CertificateItem, self).__init__(**kwargs) self.id = id self.attributes = attributes @@ -516,14 +518,13 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint -class CertificateListResult(Model): +class CertificateListResult(msrest.serialization.Model): """The certificate list result. - 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 value: A response message containing a list of certificates in the - key vault along with a link to the next page of certificates. + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. :vartype value: list[~azure.keyvault.v7_1.models.CertificateItem] :ivar next_link: The URL to get the next set of certificates. :vartype next_link: str @@ -539,25 +540,25 @@ class CertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(CertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class CertificateMergeParameters(Model): +class CertificateMergeParameters(msrest.serialization.Model): """The certificate merge parameters. All required parameters must be populated in order to send to Azure. - :param x509_certificates: Required. The certificate or the certificate - chain to merge. + :param x509_certificates: Required. The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -571,29 +572,34 @@ class CertificateMergeParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, x509_certificates, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + x509_certificates: List[bytearray], + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateMergeParameters, self).__init__(**kwargs) self.x509_certificates = x509_certificates self.certificate_attributes = certificate_attributes self.tags = tags -class CertificateOperation(Model): +class CertificateOperation(msrest.serialization.Model): """A certificate operation is returned in case of asynchronous requests. - 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 certificate id. :vartype id: str - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters - :param csr: The certificate signing request (CSR) that is being used in - the certificate operation. + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. :type csr: bytearray - :param cancellation_requested: Indicates if cancellation was requested on - the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool :param status: Status of the certificate operation. :type status: str @@ -601,8 +607,7 @@ class CertificateOperation(Model): :type status_details: str :param error: Error encountered, if any, during the certificate operation. :type error: ~azure.keyvault.v7_1.models.Error - :param target: Location which contains the result of the certificate - operation. + :param target: Location which contains the result of the certificate operation. :type target: str :param request_id: Identifier for the certificate operation. :type request_id: str @@ -624,7 +629,19 @@ class CertificateOperation(Model): 'request_id': {'key': 'request_id', 'type': 'str'}, } - def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_requested: bool=None, status: str=None, status_details: str=None, error=None, target: str=None, request_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + issuer_parameters: Optional["IssuerParameters"] = None, + csr: Optional[bytearray] = None, + cancellation_requested: Optional[bool] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + error: Optional["Error"] = None, + target: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): super(CertificateOperation, self).__init__(**kwargs) self.id = None self.issuer_parameters = issuer_parameters @@ -637,13 +654,13 @@ def __init__(self, *, issuer_parameters=None, csr: bytearray=None, cancellation_ self.request_id = request_id -class CertificateOperationUpdateParameter(Model): +class CertificateOperationUpdateParameter(msrest.serialization.Model): """The certificate operation update parameters. All required parameters must be populated in order to send to Azure. - :param cancellation_requested: Required. Indicates if cancellation was - requested on the certificate operation. + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. :type cancellation_requested: bool """ @@ -655,16 +672,20 @@ class CertificateOperationUpdateParameter(Model): 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, } - def __init__(self, *, cancellation_requested: bool, **kwargs) -> None: + def __init__( + self, + *, + cancellation_requested: bool, + **kwargs + ): super(CertificateOperationUpdateParameter, self).__init__(**kwargs) self.cancellation_requested = cancellation_requested -class CertificatePolicy(Model): +class CertificatePolicy(msrest.serialization.Model): """Management policy for a certificate. - 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 certificate id. :vartype id: str @@ -672,15 +693,12 @@ class CertificatePolicy(Model): :type key_properties: ~azure.keyvault.v7_1.models.KeyProperties :param secret_properties: Properties of the secret backing a certificate. :type secret_properties: ~azure.keyvault.v7_1.models.SecretProperties - :param x509_certificate_properties: Properties of the X509 component of a + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_1.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a certificate. - :type x509_certificate_properties: - ~azure.keyvault.v7_1.models.X509CertificateProperties - :param lifetime_actions: Actions that will be performed by Key Vault over - the lifetime of a certificate. :type lifetime_actions: list[~azure.keyvault.v7_1.models.LifetimeAction] - :param issuer_parameters: Parameters for the issuer of the X509 component - of a certificate. + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. :type issuer_parameters: ~azure.keyvault.v7_1.models.IssuerParameters :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes @@ -700,7 +718,17 @@ class CertificatePolicy(Model): 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, } - def __init__(self, *, key_properties=None, secret_properties=None, x509_certificate_properties=None, lifetime_actions=None, issuer_parameters=None, attributes=None, **kwargs) -> None: + def __init__( + self, + *, + key_properties: Optional["KeyProperties"] = None, + secret_properties: Optional["SecretProperties"] = None, + x509_certificate_properties: Optional["X509CertificateProperties"] = None, + lifetime_actions: Optional[List["LifetimeAction"]] = None, + issuer_parameters: Optional["IssuerParameters"] = None, + attributes: Optional["CertificateAttributes"] = None, + **kwargs + ): super(CertificatePolicy, self).__init__(**kwargs) self.id = None self.key_properties = key_properties @@ -711,13 +739,13 @@ def __init__(self, *, key_properties=None, secret_properties=None, x509_certific self.attributes = attributes -class CertificateRestoreParameters(Model): +class CertificateRestoreParameters(msrest.serialization.Model): """The certificate restore parameters. All required parameters must be populated in order to send to Azure. - :param certificate_bundle_backup: Required. The backup blob associated - with a certificate bundle. + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. :type certificate_bundle_backup: bytes """ @@ -729,21 +757,24 @@ class CertificateRestoreParameters(Model): 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, } - def __init__(self, *, certificate_bundle_backup: bytes, **kwargs) -> None: + def __init__( + self, + *, + certificate_bundle_backup: bytes, + **kwargs + ): super(CertificateRestoreParameters, self).__init__(**kwargs) self.certificate_bundle_backup = certificate_bundle_backup -class CertificateUpdateParameters(Model): +class CertificateUpdateParameters(msrest.serialization.Model): """The certificate update parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] """ @@ -753,14 +784,21 @@ class CertificateUpdateParameters(Model): 'tags': {'key': 'tags', 'type': '{str}'}, } - def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags=None, **kwargs) -> None: + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): super(CertificateUpdateParameters, self).__init__(**kwargs) self.certificate_policy = certificate_policy self.certificate_attributes = certificate_attributes self.tags = tags -class Contact(Model): +class Contact(msrest.serialization.Model): """The contact information for the vault certificates. :param email_address: Email address. @@ -777,18 +815,24 @@ class Contact(Model): 'phone': {'key': 'phone', 'type': 'str'}, } - def __init__(self, *, email_address: str=None, name: str=None, phone: str=None, **kwargs) -> None: + def __init__( + self, + *, + email_address: Optional[str] = None, + name: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): super(Contact, self).__init__(**kwargs) self.email_address = email_address self.name = name self.phone = phone -class Contacts(Model): +class Contacts(msrest.serialization.Model): """The contacts for the vault certificates. - 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: Identifier for the contacts collection. :vartype id: str @@ -805,18 +849,21 @@ class Contacts(Model): 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, } - def __init__(self, *, contact_list=None, **kwargs) -> None: + def __init__( + self, + *, + contact_list: Optional[List["Contact"]] = None, + **kwargs + ): super(Contacts, self).__init__(**kwargs) self.id = None self.contact_list = contact_list class DeletedCertificateBundle(CertificateBundle): - """A Deleted Certificate consisting of its previous id, attributes and its - tags, as well as information on when it will be purged. + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. - 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 certificate id. :vartype id: str @@ -834,16 +881,15 @@ class DeletedCertificateBundle(CertificateBundle): :type content_type: str :param attributes: The certificate attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -871,7 +917,16 @@ class DeletedCertificateBundle(CertificateBundle): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None @@ -879,28 +934,25 @@ def __init__(self, *, cer: bytearray=None, content_type: str=None, attributes=No class DeletedCertificateItem(CertificateItem): - """The deleted certificate item containing metadata about the deleted - certificate. + """The deleted certificate item containing metadata about the deleted certificate. - 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. :param id: Certificate identifier. :type id: str :param attributes: The certificate management attributes. :type attributes: ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value pairs. + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] :param x509_thumbprint: Thumbprint of the certificate. :type x509_thumbprint: bytes - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted certificate. + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. :type recovery_id: str - :ivar scheduled_purge_date: The time when the certificate is scheduled to - be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the certificate was deleted, in UTC - :vartype deleted_date: datetime + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime """ _validation = { @@ -918,21 +970,29 @@ class DeletedCertificateItem(CertificateItem): 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, } - def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: bytes=None, recovery_id: str=None, **kwargs) -> None: + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + recovery_id: Optional[str] = None, + **kwargs + ): super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) self.recovery_id = recovery_id self.scheduled_purge_date = None self.deleted_date = None -class DeletedCertificateListResult(Model): +class DeletedCertificateListResult(msrest.serialization.Model): """A list of certificates that have been deleted in this 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 value: A response message containing a list of deleted certificates - in the vault along with a link to the next page of deleted certificates + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. :vartype value: list[~azure.keyvault.v7_1.models.DeletedCertificateItem] :ivar next_link: The URL to get the next set of deleted certificates. :vartype next_link: str @@ -948,1908 +1008,338 @@ class DeletedCertificateListResult(Model): 'next_link': {'key': 'nextLink', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: + def __init__( + self, + **kwargs + ): super(DeletedCertificateListResult, self).__init__(**kwargs) self.value = None self.next_link = None -class KeyBundle(Model): - """A KeyBundle consisting of a WebKey plus its attributes. +class Error(msrest.serialization.Model): + """The key vault server error. - 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. - :param key: The Json web key. - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The key vault server error. + :vartype inner_error: ~azure.keyvault.v7_1.models.Error """ _validation = { - 'managed': {'readonly': True}, + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, } - def __init__(self, *, key=None, attributes=None, tags=None, **kwargs) -> None: - super(KeyBundle, self).__init__(**kwargs) - self.key = key - self.attributes = attributes - self.tags = tags - self.managed = None + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None -class DeletedKeyBundle(KeyBundle): - """A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion - info. +class IssuerAttributes(msrest.serialization.Model): + """The attributes of an issuer managed by the Key Vault service. - 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. - :param key: The Json web key. - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :param enabled: Determines whether the issuer is enabled. + :type enabled: bool + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime """ _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'created': {'readonly': True}, + 'updated': {'readonly': True}, } _attribute_map = { - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, } - def __init__(self, *, key=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: - super(DeletedKeyBundle, self).__init__(key=key, attributes=attributes, tags=tags, **kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + super(IssuerAttributes, self).__init__(**kwargs) + self.enabled = enabled + self.created = None + self.updated = None -class KeyItem(Model): - """The key item containing key metadata. +class IssuerBundle(msrest.serialization.Model): + """The issuer for Key Vault certificate. - 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. - :param kid: Key identifier. - :type kid: str - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool + :ivar id: Identifier for the issuer object. + :vartype id: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes """ _validation = { - 'managed': {'readonly': True}, + 'id': {'readonly': True}, } _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, **kwargs) -> None: - super(KeyItem, self).__init__(**kwargs) - self.kid = kid + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): + super(IssuerBundle, self).__init__(**kwargs) + self.id = None + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details self.attributes = attributes - self.tags = tags - self.managed = None - -class DeletedKeyItem(KeyItem): - """The deleted key item containing the deleted key metadata and information - about deletion. - Variables are only populated by the server, and will be ignored when - sending a request. +class IssuerCredentials(msrest.serialization.Model): + """The credentials to be used for the certificate issuer. - :param kid: Key identifier. - :type kid: str - :param attributes: The key management attributes. - :type attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar managed: True if the key's lifetime is managed by key vault. If this - is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted key. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the key is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the key was deleted, in UTC - :vartype deleted_date: datetime + :param account_id: The user name/account name/account id. + :type account_id: str + :param password: The password/secret/account key. + :type password: str """ - _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'account_id': {'key': 'account_id', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, } - def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: - super(DeletedKeyItem, self).__init__(kid=kid, attributes=attributes, tags=tags, **kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - + def __init__( + self, + *, + account_id: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(IssuerCredentials, self).__init__(**kwargs) + self.account_id = account_id + self.password = password -class DeletedKeyListResult(Model): - """A list of keys that have been deleted in this vault. - Variables are only populated by the server, and will be ignored when - sending a request. +class IssuerParameters(msrest.serialization.Model): + """Parameters for the issuer of the X509 component of a certificate. - :ivar value: A response message containing a list of deleted keys in the - vault along with a link to the next page of deleted keys - :vartype value: list[~azure.keyvault.v7_1.models.DeletedKeyItem] - :ivar next_link: The URL to get the next set of deleted keys. - :vartype next_link: str + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. + :type name: str + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. + :type certificate_type: str + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. + :type certificate_transparency: bool """ - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'certificate_type': {'key': 'cty', 'type': 'str'}, + 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, } - def __init__(self, **kwargs) -> None: - super(DeletedKeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - + def __init__( + self, + *, + name: Optional[str] = None, + certificate_type: Optional[str] = None, + certificate_transparency: Optional[bool] = None, + **kwargs + ): + super(IssuerParameters, self).__init__(**kwargs) + self.name = name + self.certificate_type = certificate_type + self.certificate_transparency = certificate_transparency -class SasDefinitionBundle(Model): - """A SAS definition bundle consists of key vault SAS definition details plus - its attributes. - Variables are only populated by the server, and will be ignored when - sending a request. +class KeyProperties(msrest.serialization.Model): + """Properties of the key pair backing a certificate. - :ivar id: The SAS definition id. - :vartype id: str - :ivar secret_id: Storage account SAS definition secret id. - :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :vartype sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. - :vartype validity_period: str - :ivar attributes: The SAS definition attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct". + :type key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. + :type reuse_key: bool + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". + :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName """ - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'template_uri': {'readonly': True}, - 'sas_type': {'readonly': True}, - 'validity_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'exportable': {'key': 'exportable', 'type': 'bool'}, + 'key_type': {'key': 'kty', 'type': 'str'}, + 'key_size': {'key': 'key_size', 'type': 'int'}, + 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, + 'curve': {'key': 'crv', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(SasDefinitionBundle, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.template_uri = None - self.sas_type = None - self.validity_period = None - self.attributes = None - self.tags = None + def __init__( + self, + *, + exportable: Optional[bool] = None, + key_type: Optional[Union[str, "JsonWebKeyType"]] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.exportable = exportable + self.key_type = key_type + self.key_size = key_size + self.reuse_key = reuse_key + self.curve = curve -class DeletedSasDefinitionBundle(SasDefinitionBundle): - """A deleted SAS definition bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. +class KeyVaultError(msrest.serialization.Model): + """The key vault error exception. - 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 SAS definition id. - :vartype id: str - :ivar secret_id: Storage account SAS definition secret id. - :vartype secret_id: str - :ivar template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :vartype template_uri: str - :ivar sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :vartype sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :ivar validity_period: The validity period of SAS tokens created according - to the SAS definition. - :vartype validity_period: str - :ivar attributes: The SAS definition attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar error: The key vault server error. + :vartype error: ~azure.keyvault.v7_1.models.Error """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'template_uri': {'readonly': True}, - 'sas_type': {'readonly': True}, - 'validity_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'error': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + 'error': {'key': 'error', 'type': 'Error'}, } - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: - super(DeletedSasDefinitionBundle, self).__init__(**kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - + def __init__( + self, + **kwargs + ): + super(KeyVaultError, self).__init__(**kwargs) + self.error = None -class SasDefinitionItem(Model): - """The SAS definition item containing storage SAS definition metadata. - Variables are only populated by the server, and will be ignored when - sending a request. +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. - :ivar id: The storage SAS identifier. - :vartype id: str - :ivar secret_id: The storage account SAS definition secret id. - :vartype secret_id: str - :ivar attributes: The SAS definition management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] + :param trigger: The condition that will execute the action. + :type trigger: ~azure.keyvault.v7_1.models.Trigger + :param action: The action that will be executed. + :type action: ~azure.keyvault.v7_1.models.Action """ - _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, } + def __init__( + self, + *, + trigger: Optional["Trigger"] = None, + action: Optional["Action"] = None, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = trigger + self.action = action + + +class OrganizationDetails(msrest.serialization.Model): + """Details of the organization of the certificate issuer. + + :param id: Id of the organization. + :type id: str + :param admin_details: Details of the organization administrator. + :type admin_details: list[~azure.keyvault.v7_1.models.AdministratorDetails] + """ + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, + 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, } - def __init__(self, **kwargs) -> None: - super(SasDefinitionItem, self).__init__(**kwargs) - self.id = None - self.secret_id = None - self.attributes = None - self.tags = None + def __init__( + self, + *, + id: Optional[str] = None, + admin_details: Optional[List["AdministratorDetails"]] = None, + **kwargs + ): + super(OrganizationDetails, self).__init__(**kwargs) + self.id = id + self.admin_details = admin_details -class DeletedSasDefinitionItem(SasDefinitionItem): - """The deleted SAS definition item containing metadata about the deleted SAS - definition. +class PendingCertificateSigningRequestResult(msrest.serialization.Model): + """The pending certificate signing request result. - 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 storage SAS identifier. - :vartype id: str - :ivar secret_id: The storage account SAS definition secret id. - :vartype secret_id: str - :ivar attributes: The SAS definition management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted SAS definition. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the SAS definition is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the SAS definition was deleted, in UTC - :vartype deleted_date: datetime + :ivar value: The pending certificate signing request as Base64 encoded string. + :vartype value: str """ _validation = { - 'id': {'readonly': True}, - 'secret_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, + 'value': {'readonly': True}, } _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'secret_id': {'key': 'sid', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: - super(DeletedSasDefinitionItem, self).__init__(**kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedSasDefinitionListResult(Model): - """The deleted SAS definition list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted SAS - definitions in the vault along with a link to the next page of deleted sas - definitions - :vartype value: list[~azure.keyvault.v7_1.models.DeletedSasDefinitionItem] - :ivar next_link: The URL to get the next set of deleted SAS definitions. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(DeletedSasDefinitionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SecretBundle(Model): - """A secret consisting of a value, id and its attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param value: The secret value. - :type value: str - :param id: The secret id. - :type id: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. - :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. - :vartype managed: bool - """ - - _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kid': {'key': 'kid', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, **kwargs) -> None: - super(SecretBundle, self).__init__(**kwargs) - self.value = value - self.id = id - self.content_type = content_type - self.attributes = attributes - self.tags = tags - self.kid = None - self.managed = None - - -class DeletedSecretBundle(SecretBundle): - """A Deleted Secret consisting of its previous id, attributes and its tags, as - well as information on when it will be purged. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param value: The secret value. - :type value: str - :param id: The secret id. - :type id: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :ivar kid: If this is a secret backing a KV certificate, then this field - specifies the corresponding key backing the KV certificate. - :vartype kid: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a secret backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'kid': {'readonly': True}, - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'kid': {'key': 'kid', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, *, value: str=None, id: str=None, content_type: str=None, attributes=None, tags=None, recovery_id: str=None, **kwargs) -> None: - super(DeletedSecretBundle, self).__init__(value=value, id=id, content_type=content_type, attributes=attributes, tags=tags, **kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - - -class SecretItem(Model): - """The secret item containing secret metadata. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Secret identifier. - :type id: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. - :vartype managed: bool - """ - - _validation = { - 'managed': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - } - - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, **kwargs) -> None: - super(SecretItem, self).__init__(**kwargs) - self.id = id - self.attributes = attributes - self.tags = tags - self.content_type = content_type - self.managed = None - - -class DeletedSecretItem(SecretItem): - """The deleted secret item containing metadata about the deleted secret. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param id: Secret identifier. - :type id: str - :param attributes: The secret management attributes. - :type attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :ivar managed: True if the secret's lifetime is managed by key vault. If - this is a key backing a certificate, then managed will be true. - :vartype managed: bool - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted secret. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the secret is scheduled to be - purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the secret was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'managed': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'managed': {'key': 'managed', 'type': 'bool'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: str=None, recovery_id: str=None, **kwargs) -> None: - super(DeletedSecretItem, self).__init__(id=id, attributes=attributes, tags=tags, content_type=content_type, **kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedSecretListResult(Model): - """The deleted secret list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted secrets - in the vault along with a link to the next page of deleted secrets - :vartype value: list[~azure.keyvault.v7_1.models.DeletedSecretItem] - :ivar next_link: The URL to get the next set of deleted secrets. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(DeletedSecretListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageAccountItem(Model): - """The storage account item containing storage account metadata. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Storage identifier. - :vartype id: str - :ivar resource_id: Storage account resource Id. - :vartype resource_id: str - :ivar attributes: The storage account management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs) -> None: - super(StorageAccountItem, self).__init__(**kwargs) - self.id = None - self.resource_id = None - self.attributes = None - self.tags = None - - -class DeletedStorageAccountItem(StorageAccountItem): - """The deleted storage account item containing metadata about the deleted - storage account. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Storage identifier. - :vartype id: str - :ivar resource_id: Storage account resource Id. - :vartype resource_id: str - :ivar attributes: The storage account management attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs. - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: - super(DeletedStorageAccountItem, self).__init__(**kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - - -class StorageBundle(Model): - """A Storage account bundle consists of key vault storage account details plus - its attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The storage account id. - :vartype id: str - :ivar resource_id: The storage account resource id. - :vartype resource_id: str - :ivar active_key_name: The current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. - :vartype regeneration_period: str - :ivar attributes: The storage account attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'active_key_name': {'readonly': True}, - 'auto_regenerate_key': {'readonly': True}, - 'regeneration_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, **kwargs) -> None: - super(StorageBundle, self).__init__(**kwargs) - self.id = None - self.resource_id = None - self.active_key_name = None - self.auto_regenerate_key = None - self.regeneration_period = None - self.attributes = None - self.tags = None - - -class DeletedStorageBundle(StorageBundle): - """A deleted storage account bundle consisting of its previous id, attributes - and its tags, as well as information on when it will be purged. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: The storage account id. - :vartype id: str - :ivar resource_id: The storage account resource id. - :vartype resource_id: str - :ivar active_key_name: The current active storage account key name. - :vartype active_key_name: str - :ivar auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :vartype auto_regenerate_key: bool - :ivar regeneration_period: The key regeneration time duration specified in - ISO-8601 format. - :vartype regeneration_period: str - :ivar attributes: The storage account attributes. - :vartype attributes: ~azure.keyvault.v7_1.models.StorageAccountAttributes - :ivar tags: Application specific metadata in the form of key-value pairs - :vartype tags: dict[str, str] - :param recovery_id: The url of the recovery object, used to identify and - recover the deleted storage account. - :type recovery_id: str - :ivar scheduled_purge_date: The time when the storage account is scheduled - to be purged, in UTC - :vartype scheduled_purge_date: datetime - :ivar deleted_date: The time when the storage account was deleted, in UTC - :vartype deleted_date: datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'active_key_name': {'readonly': True}, - 'auto_regenerate_key': {'readonly': True}, - 'regeneration_period': {'readonly': True}, - 'attributes': {'readonly': True}, - 'tags': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'deleted_date': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, - 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, - } - - def __init__(self, *, recovery_id: str=None, **kwargs) -> None: - super(DeletedStorageBundle, self).__init__(**kwargs) - self.recovery_id = recovery_id - self.scheduled_purge_date = None - self.deleted_date = None - - -class DeletedStorageListResult(Model): - """The deleted storage account list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of the deleted storage - accounts in the vault along with a link to the next page of deleted - storage accounts - :vartype value: - list[~azure.keyvault.v7_1.models.DeletedStorageAccountItem] - :ivar next_link: The URL to get the next set of deleted storage accounts. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(DeletedStorageListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class Error(Model): - """The key vault server error. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar inner_error: - :vartype inner_error: ~azure.keyvault.v7_1.models.Error - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_error': {'key': 'innererror', 'type': 'Error'}, - } - - def __init__(self, **kwargs) -> None: - super(Error, self).__init__(**kwargs) - self.code = None - self.message = None - self.inner_error = None - - -class IssuerAttributes(Model): - """The attributes of an issuer managed by the Key Vault service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the issuer is enabled. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__(self, *, enabled: bool=None, **kwargs) -> None: - super(IssuerAttributes, self).__init__(**kwargs) - self.enabled = enabled - self.created = None - self.updated = None - - -class IssuerBundle(Model): - """The issuer for Key Vault certificate. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar id: Identifier for the issuer object. - :vartype id: str - :param provider: The issuer provider. - :type provider: str - :param credentials: The credentials to be used for the issuer. - :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided to - the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails - :param attributes: Attributes of the issuer object. - :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'provider': {'key': 'provider', 'type': 'str'}, - 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, - 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, - 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, - } - - def __init__(self, *, provider: str=None, credentials=None, organization_details=None, attributes=None, **kwargs) -> None: - super(IssuerBundle, self).__init__(**kwargs) - self.id = None - self.provider = provider - self.credentials = credentials - self.organization_details = organization_details - self.attributes = attributes - - -class IssuerCredentials(Model): - """The credentials to be used for the certificate issuer. - - :param account_id: The user name/account name/account id. - :type account_id: str - :param password: The password/secret/account key. - :type password: str - """ - - _attribute_map = { - 'account_id': {'key': 'account_id', 'type': 'str'}, - 'password': {'key': 'pwd', 'type': 'str'}, - } - - def __init__(self, *, account_id: str=None, password: str=None, **kwargs) -> None: - super(IssuerCredentials, self).__init__(**kwargs) - self.account_id = account_id - self.password = password - - -class IssuerParameters(Model): - """Parameters for the issuer of the X509 component of a certificate. - - :param name: Name of the referenced issuer object or reserved names; for - example, 'Self' or 'Unknown'. - :type name: str - :param certificate_type: Certificate type as supported by the provider - (optional); for example 'OV-SSL', 'EV-SSL' - :type certificate_type: str - :param certificate_transparency: Indicates if the certificates generated - under this policy should be published to certificate transparency logs. - :type certificate_transparency: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'certificate_type': {'key': 'cty', 'type': 'str'}, - 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, - } - - def __init__(self, *, name: str=None, certificate_type: str=None, certificate_transparency: bool=None, **kwargs) -> None: - super(IssuerParameters, self).__init__(**kwargs) - self.name = name - self.certificate_type = certificate_type - self.certificate_transparency = certificate_transparency - - -class JsonWebKey(Model): - """As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18. - - :param kid: Key identifier. - :type kid: str - :param kty: JsonWebKey Key Type (kty), as defined in - https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str] - :param n: RSA modulus. - :type n: bytes - :param e: RSA public exponent. - :type e: bytes - :param d: RSA private exponent, or the D component of an EC private key. - :type d: bytes - :param dp: RSA private key parameter. - :type dp: bytes - :param dq: RSA private key parameter. - :type dq: bytes - :param qi: RSA private key parameter. - :type qi: bytes - :param p: RSA secret prime. - :type p: bytes - :param q: RSA secret prime, with p < q. - :type q: bytes - :param k: Symmetric key. - :type k: bytes - :param t: HSM Token, used with 'Bring Your Own Key'. - :type t: bytes - :param crv: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type crv: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :param x: X component of an EC public key. - :type x: bytes - :param y: Y component of an EC public key. - :type y: bytes - """ - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'n': {'key': 'n', 'type': 'base64'}, - 'e': {'key': 'e', 'type': 'base64'}, - 'd': {'key': 'd', 'type': 'base64'}, - 'dp': {'key': 'dp', 'type': 'base64'}, - 'dq': {'key': 'dq', 'type': 'base64'}, - 'qi': {'key': 'qi', 'type': 'base64'}, - 'p': {'key': 'p', 'type': 'base64'}, - 'q': {'key': 'q', 'type': 'base64'}, - 'k': {'key': 'k', 'type': 'base64'}, - 't': {'key': 'key_hsm', 'type': 'base64'}, - 'crv': {'key': 'crv', 'type': 'str'}, - 'x': {'key': 'x', 'type': 'base64'}, - 'y': {'key': 'y', 'type': 'base64'}, - } - - def __init__(self, *, kid: str=None, kty=None, key_ops=None, n: bytes=None, e: bytes=None, d: bytes=None, dp: bytes=None, dq: bytes=None, qi: bytes=None, p: bytes=None, q: bytes=None, k: bytes=None, t: bytes=None, crv=None, x: bytes=None, y: bytes=None, **kwargs) -> None: - super(JsonWebKey, self).__init__(**kwargs) - self.kid = kid - self.kty = kty - self.key_ops = key_ops - self.n = n - self.e = e - self.d = d - self.dp = dp - self.dq = dq - self.qi = qi - self.p = p - self.q = q - self.k = k - self.t = t - self.crv = crv - self.x = x - self.y = y - - -class KeyAttributes(Attributes): - """The attributes of a key managed by the key vault service. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in UTC. - :type not_before: datetime - :param expires: Expiry date in UTC. - :type expires: datetime - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for keys in the current vault. If it contains 'Purgeable' the key - can be permanently deleted by a privileged user; otherwise, only the - system can purge the key, at the end of the retention interval. Possible - values include: 'Purgeable', 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: - super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class KeyCreateParameters(Model): - """The key create parameters. - - All required parameters must be populated in order to send to Azure. - - :param kty: Required. The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', - 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. - :type key_size: int - :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - - _validation = { - 'kty': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'curve': {'key': 'crv', 'type': 'str'}, - } - - def __init__(self, *, kty, key_size: int=None, key_ops=None, key_attributes=None, tags=None, curve=None, **kwargs) -> None: - super(KeyCreateParameters, self).__init__(**kwargs) - self.kty = kty - self.key_size = key_size - self.key_ops = key_ops - self.key_attributes = key_attributes - self.tags = tags - self.curve = curve - - -class KeyImportParameters(Model): - """The key import parameters. - - All required parameters must be populated in order to send to Azure. - - :param hsm: Whether to import as a hardware key (HSM) or software key. - :type hsm: bool - :param key: Required. The Json web key - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param key_attributes: The key management attributes. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'key': {'required': True}, - } - - _attribute_map = { - 'hsm': {'key': 'Hsm', 'type': 'bool'}, - 'key': {'key': 'key', 'type': 'JsonWebKey'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwargs) -> None: - super(KeyImportParameters, self).__init__(**kwargs) - self.hsm = hsm - self.key = key - self.key_attributes = key_attributes - self.tags = tags - - -class KeyListResult(Model): - """The key list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of keys in the key vault - along with a link to the next page of keys. - :vartype value: list[~azure.keyvault.v7_1.models.KeyItem] - :ivar next_link: The URL to get the next set of keys. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[KeyItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(KeyListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class KeyOperationResult(Model): - """The key operation result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar kid: Key identifier - :vartype kid: str - :ivar result: - :vartype result: bytes - """ - - _validation = { - 'kid': {'readonly': True}, - 'result': {'readonly': True}, - } - - _attribute_map = { - 'kid': {'key': 'kid', 'type': 'str'}, - 'result': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, **kwargs) -> None: - super(KeyOperationResult, self).__init__(**kwargs) - self.kid = None - self.result = None - - -class KeyOperationsParameters(Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: Required. - :type value: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: - super(KeyOperationsParameters, self).__init__(**kwargs) - self.algorithm = algorithm - self.value = value - - -class KeyProperties(Model): - """Properties of the key pair backing a certificate. - - :param exportable: Indicates if the private key can be exported. - :type exportable: bool - :param key_type: The type of key pair to be used for the certificate. - Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' - :type key_type: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 - for RSA. - :type key_size: int - :param reuse_key: Indicates if the same key pair will be used on - certificate renewal. - :type reuse_key: bool - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', 'P-521', - 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - """ - - _attribute_map = { - 'exportable': {'key': 'exportable', 'type': 'bool'}, - 'key_type': {'key': 'kty', 'type': 'str'}, - 'key_size': {'key': 'key_size', 'type': 'int'}, - 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, - 'curve': {'key': 'crv', 'type': 'str'}, - } - - def __init__(self, *, exportable: bool=None, key_type=None, key_size: int=None, reuse_key: bool=None, curve=None, **kwargs) -> None: - super(KeyProperties, self).__init__(**kwargs) - self.exportable = exportable - self.key_type = key_type - self.key_size = key_size - self.reuse_key = reuse_key - self.curve = curve - - -class KeyRestoreParameters(Model): - """The key restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param key_bundle_backup: Required. The backup blob associated with a key - bundle. - :type key_bundle_backup: bytes - """ - - _validation = { - 'key_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'key_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, key_bundle_backup: bytes, **kwargs) -> None: - super(KeyRestoreParameters, self).__init__(**kwargs) - self.key_bundle_backup = key_bundle_backup - - -class KeySignParameters(Model): - """The key operations parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. The signing/verification algorithm identifier. - For more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', 'PS384', - 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', - 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param value: Required. - :type value: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'value': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, algorithm, value: bytes, **kwargs) -> None: - super(KeySignParameters, self).__init__(**kwargs) - self.algorithm = algorithm - self.value = value - - -class KeyUpdateParameters(Model): - """The key update parameters. - - :param key_ops: Json web key operations. For more information on possible - key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'key_ops': {'key': 'key_ops', 'type': '[str]'}, - 'key_attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, key_ops=None, key_attributes=None, tags=None, **kwargs) -> None: - super(KeyUpdateParameters, self).__init__(**kwargs) - self.key_ops = key_ops - self.key_attributes = key_attributes - self.tags = tags - - -class KeyVaultError(Model): - """The key vault error exception. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar error: - :vartype error: ~azure.keyvault.v7_1.models.Error - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__(self, **kwargs) -> None: - super(KeyVaultError, self).__init__(**kwargs) - self.error = None - - -class KeyVaultErrorException(HttpResponseError): - """Server responsed with exception of type: 'KeyVaultError'. - - :param deserialize: A deserializer - :param response: Server response to be deserialized. - """ - - def __init__(self, response, deserialize, *args): - - model_name = 'KeyVaultError' - self.error = deserialize(model_name, response) - if self.error is None: - self.error = deserialize.dependencies[model_name]() - super(KeyVaultErrorException, self).__init__(response=response) - - -class KeyVerifyParameters(Model): - """The key verify parameters. - - All required parameters must be populated in order to send to Azure. - - :param algorithm: Required. The signing/verification algorithm. For more - information on possible algorithm types, see JsonWebKeySignatureAlgorithm. - Possible values include: 'PS256', 'PS384', 'PS512', 'RS256', 'RS384', - 'RS512', 'RSNULL', 'ES256', 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param digest: Required. The digest used for signing. - :type digest: bytes - :param signature: Required. The signature to be verified. - :type signature: bytes - """ - - _validation = { - 'algorithm': {'required': True, 'min_length': 1}, - 'digest': {'required': True}, - 'signature': {'required': True}, - } - - _attribute_map = { - 'algorithm': {'key': 'alg', 'type': 'str'}, - 'digest': {'key': 'digest', 'type': 'base64'}, - 'signature': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, algorithm, digest: bytes, signature: bytes, **kwargs) -> None: - super(KeyVerifyParameters, self).__init__(**kwargs) - self.algorithm = algorithm - self.digest = digest - self.signature = signature - - -class KeyVerifyResult(Model): - """The key verify result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: True if the signature is verified, otherwise false. - :vartype value: bool - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'bool'}, - } - - def __init__(self, **kwargs) -> None: - super(KeyVerifyResult, self).__init__(**kwargs) - self.value = None - - -class LifetimeAction(Model): - """Action and its trigger that will be performed by Key Vault over the - lifetime of a certificate. - - :param trigger: The condition that will execute the action. - :type trigger: ~azure.keyvault.v7_1.models.Trigger - :param action: The action that will be executed. - :type action: ~azure.keyvault.v7_1.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__(self, *, trigger=None, action=None, **kwargs) -> None: - super(LifetimeAction, self).__init__(**kwargs) - self.trigger = trigger - self.action = action - - -class OrganizationDetails(Model): - """Details of the organization of the certificate issuer. - - :param id: Id of the organization. - :type id: str - :param admin_details: Details of the organization administrator. - :type admin_details: - list[~azure.keyvault.v7_1.models.AdministratorDetails] - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, - } - - def __init__(self, *, id: str=None, admin_details=None, **kwargs) -> None: - super(OrganizationDetails, self).__init__(**kwargs) - self.id = id - self.admin_details = admin_details - - -class PendingCertificateSigningRequestResult(Model): - """The pending certificate signing request result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: The pending certificate signing request as Base64 encoded - string. - :vartype value: str - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) - self.value = None - - -class SasDefinitionAttributes(Model): - """The SAS definition management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: the enabled state of the object. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for SAS definitions in the current vault. If it contains - 'Purgeable' the SAS definition can be permanently deleted by a privileged - user; otherwise, only the system can purge the SAS definition, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, *, enabled: bool=None, **kwargs) -> None: - super(SasDefinitionAttributes, self).__init__(**kwargs) - self.enabled = enabled - self.created = None - self.updated = None - self.recoverable_days = None - self.recovery_level = None - - -class SasDefinitionCreateParameters(Model): - """The SAS definition create parameters. - - All required parameters must be populated in order to send to Azure. - - :param template_uri: Required. The SAS definition token template signed - with an arbitrary key. Tokens created according to the SAS definition - will have the same properties as the template. - :type template_uri: str - :param sas_type: Required. The type of SAS token the SAS definition will - create. Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: Required. The validity period of SAS tokens - created according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'template_uri': {'required': True}, - 'sas_type': {'required': True}, - 'validity_period': {'required': True}, - } - - _attribute_map = { - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, template_uri: str, sas_type, validity_period: str, sas_definition_attributes=None, tags=None, **kwargs) -> None: - super(SasDefinitionCreateParameters, self).__init__(**kwargs) - self.template_uri = template_uri - self.sas_type = sas_type - self.validity_period = validity_period - self.sas_definition_attributes = sas_definition_attributes - self.tags = tags - - -class SasDefinitionListResult(Model): - """The storage account SAS definition list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of SAS definitions along - with a link to the next page of SAS definitions. - :vartype value: list[~azure.keyvault.v7_1.models.SasDefinitionItem] - :ivar next_link: The URL to get the next set of SAS definitions. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(SasDefinitionListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SasDefinitionUpdateParameters(Model): - """The SAS definition update parameters. - - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will have - the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'template_uri': {'key': 'templateUri', 'type': 'str'}, - 'sas_type': {'key': 'sasType', 'type': 'str'}, - 'validity_period': {'key': 'validityPeriod', 'type': 'str'}, - 'sas_definition_attributes': {'key': 'attributes', 'type': 'SasDefinitionAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, template_uri: str=None, sas_type=None, validity_period: str=None, sas_definition_attributes=None, tags=None, **kwargs) -> None: - super(SasDefinitionUpdateParameters, self).__init__(**kwargs) - self.template_uri = template_uri - self.sas_type = sas_type - self.validity_period = validity_period - self.sas_definition_attributes = sas_definition_attributes - self.tags = tags - - -class SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in UTC. - :type not_before: datetime - :param expires: Expiry date in UTC. - :type expires: datetime - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for secrets in the current vault. If it contains 'Purgeable', the - secret can be permanently deleted by a privileged user; otherwise, only - the system can purge the secret, at the end of the retention interval. - Possible values include: 'Purgeable', 'Recoverable+Purgeable', - 'Recoverable', 'Recoverable+ProtectedSubscription', - 'CustomizedRecoverable+Purgeable', 'CustomizedRecoverable', - 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwargs) -> None: - super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) - self.recoverable_days = None - self.recovery_level = None - - -class SecretListResult(Model): - """The secret list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of secrets in the key - vault along with a link to the next page of secrets. - :vartype value: list[~azure.keyvault.v7_1.models.SecretItem] - :ivar next_link: The URL to get the next set of secrets. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SecretItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, **kwargs) -> None: - super(SecretListResult, self).__init__(**kwargs) + def __init__( + self, + **kwargs + ): + super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) self.value = None - self.next_link = None -class SecretProperties(Model): +class SecretProperties(msrest.serialization.Model): """Properties of the key backing a certificate. :param content_type: The media type (MIME type). @@ -2860,300 +1350,17 @@ class SecretProperties(Model): 'content_type': {'key': 'contentType', 'type': 'str'}, } - def __init__(self, *, content_type: str=None, **kwargs) -> None: + def __init__( + self, + *, + content_type: Optional[str] = None, + **kwargs + ): super(SecretProperties, self).__init__(**kwargs) self.content_type = content_type -class SecretRestoreParameters(Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param secret_bundle_backup: Required. The backup blob associated with a - secret bundle. - :type secret_bundle_backup: bytes - """ - - _validation = { - 'secret_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'secret_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, secret_bundle_backup: bytes, **kwargs) -> None: - super(SecretRestoreParameters, self).__init__(**kwargs) - self.secret_bundle_backup = secret_bundle_backup - - -class SecretSetParameters(Model): - """The secret set parameters. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The value of the secret. - :type value: str - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - } - - def __init__(self, *, value: str, tags=None, content_type: str=None, secret_attributes=None, **kwargs) -> None: - super(SecretSetParameters, self).__init__(**kwargs) - self.value = value - self.tags = tags - self.content_type = content_type - self.secret_attributes = secret_attributes - - -class SecretUpdateParameters(Model): - """The secret update parameters. - - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'secret_attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, content_type: str=None, secret_attributes=None, tags=None, **kwargs) -> None: - super(SecretUpdateParameters, self).__init__(**kwargs) - self.content_type = content_type - self.secret_attributes = secret_attributes - self.tags = tags - - -class StorageAccountAttributes(Model): - """The storage account management attributes. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :param enabled: the enabled state of the object. - :type enabled: bool - :ivar created: Creation time in UTC. - :vartype created: datetime - :ivar updated: Last updated time in UTC. - :vartype updated: datetime - :ivar recoverable_days: softDelete data retention days. Value should be - >=7 and <=90 when softDelete enabled, otherwise 0. - :vartype recoverable_days: int - :ivar recovery_level: Reflects the deletion recovery level currently in - effect for storage accounts in the current vault. If it contains - 'Purgeable' the storage account can be permanently deleted by a privileged - user; otherwise, only the system can purge the storage account, at the end - of the retention interval. Possible values include: 'Purgeable', - 'Recoverable+Purgeable', 'Recoverable', - 'Recoverable+ProtectedSubscription', 'CustomizedRecoverable+Purgeable', - 'CustomizedRecoverable', 'CustomizedRecoverable+ProtectedSubscription' - :vartype recovery_level: str or - ~azure.keyvault.v7_1.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recoverable_days': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__(self, *, enabled: bool=None, **kwargs) -> None: - super(StorageAccountAttributes, self).__init__(**kwargs) - self.enabled = enabled - self.created = None - self.updated = None - self.recoverable_days = None - self.recovery_level = None - - -class StorageAccountCreateParameters(Model): - """The storage account create parameters. - - All required parameters must be populated in order to send to Azure. - - :param resource_id: Required. Storage account resource id. - :type resource_id: str - :param active_key_name: Required. Current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: Required. whether keyvault should manage the - storage account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _validation = { - 'resource_id': {'required': True}, - 'active_key_name': {'required': True}, - 'auto_regenerate_key': {'required': True}, - } - - _attribute_map = { - 'resource_id': {'key': 'resourceId', 'type': 'str'}, - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'storage_account_attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, resource_id: str, active_key_name: str, auto_regenerate_key: bool, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: - super(StorageAccountCreateParameters, self).__init__(**kwargs) - self.resource_id = resource_id - self.active_key_name = active_key_name - self.auto_regenerate_key = auto_regenerate_key - self.regeneration_period = regeneration_period - self.storage_account_attributes = storage_account_attributes - self.tags = tags - - -class StorageAccountRegenerteKeyParameters(Model): - """The storage account key regenerate parameters. - - All required parameters must be populated in order to send to Azure. - - :param key_name: Required. The storage account key name. - :type key_name: str - """ - - _validation = { - 'key_name': {'required': True}, - } - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - } - - def __init__(self, *, key_name: str, **kwargs) -> None: - super(StorageAccountRegenerteKeyParameters, self).__init__(**kwargs) - self.key_name = key_name - - -class StorageAccountUpdateParameters(Model): - """The storage account update parameters. - - :param active_key_name: The current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration specified - in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value pairs. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'active_key_name': {'key': 'activeKeyName', 'type': 'str'}, - 'auto_regenerate_key': {'key': 'autoRegenerateKey', 'type': 'bool'}, - 'regeneration_period': {'key': 'regenerationPeriod', 'type': 'str'}, - 'storage_account_attributes': {'key': 'attributes', 'type': 'StorageAccountAttributes'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, regeneration_period: str=None, storage_account_attributes=None, tags=None, **kwargs) -> None: - super(StorageAccountUpdateParameters, self).__init__(**kwargs) - self.active_key_name = active_key_name - self.auto_regenerate_key = auto_regenerate_key - self.regeneration_period = regeneration_period - self.storage_account_attributes = storage_account_attributes - self.tags = tags - - -class StorageListResult(Model): - """The storage accounts list result. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: A response message containing a list of storage accounts in - the key vault along with a link to the next page of storage accounts. - :vartype value: list[~azure.keyvault.v7_1.models.StorageAccountItem] - :ivar next_link: The URL to get the next set of storage accounts. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(StorageListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class StorageRestoreParameters(Model): - """The secret restore parameters. - - All required parameters must be populated in order to send to Azure. - - :param storage_bundle_backup: Required. The backup blob associated with a - storage account. - :type storage_bundle_backup: bytes - """ - - _validation = { - 'storage_bundle_backup': {'required': True}, - } - - _attribute_map = { - 'storage_bundle_backup': {'key': 'value', 'type': 'base64'}, - } - - def __init__(self, *, storage_bundle_backup: bytes, **kwargs) -> None: - super(StorageRestoreParameters, self).__init__(**kwargs) - self.storage_bundle_backup = storage_bundle_backup - - -class SubjectAlternativeNames(Model): +class SubjectAlternativeNames(msrest.serialization.Model): """The subject alternate names of a X509 object. :param emails: Email addresses. @@ -3170,23 +1377,29 @@ class SubjectAlternativeNames(Model): 'upns': {'key': 'upns', 'type': '[str]'}, } - def __init__(self, *, emails=None, dns_names=None, upns=None, **kwargs) -> None: + def __init__( + self, + *, + emails: Optional[List[str]] = None, + dns_names: Optional[List[str]] = None, + upns: Optional[List[str]] = None, + **kwargs + ): super(SubjectAlternativeNames, self).__init__(**kwargs) self.emails = emails self.dns_names = dns_names self.upns = upns -class Trigger(Model): +class Trigger(msrest.serialization.Model): """A condition to be satisfied for an action to be executed. - :param lifetime_percentage: Percentage of lifetime at which to trigger. - Value should be between 1 and 99. + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. :type lifetime_percentage: int - :param days_before_expiry: Days before expiry to attempt renewal. Value - should be between 1 and validity_in_months multiplied by 27. If - validity_in_months is 36, then value should be between 1 and 972 (36 * - 27). + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). :type days_before_expiry: int """ @@ -3199,27 +1412,30 @@ class Trigger(Model): 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, } - def __init__(self, *, lifetime_percentage: int=None, days_before_expiry: int=None, **kwargs) -> None: + def __init__( + self, + *, + lifetime_percentage: Optional[int] = None, + days_before_expiry: Optional[int] = None, + **kwargs + ): super(Trigger, self).__init__(**kwargs) self.lifetime_percentage = lifetime_percentage self.days_before_expiry = days_before_expiry -class X509CertificateProperties(Model): +class X509CertificateProperties(msrest.serialization.Model): """Properties of the X509 component of a certificate. - :param subject: The subject name. Should be a valid X509 distinguished - Name. + :param subject: The subject name. Should be a valid X509 distinguished Name. :type subject: str :param ekus: The enhanced key usage. :type ekus: list[str] :param subject_alternative_names: The subject alternative names. - :type subject_alternative_names: - ~azure.keyvault.v7_1.models.SubjectAlternativeNames + :type subject_alternative_names: ~azure.keyvault.v7_1.models.SubjectAlternativeNames :param key_usage: List of key usages. :type key_usage: list[str or ~azure.keyvault.v7_1.models.KeyUsageType] - :param validity_in_months: The duration that the certificate is valid in - months. + :param validity_in_months: The duration that the certificate is valid in months. :type validity_in_months: int """ @@ -3235,7 +1451,16 @@ class X509CertificateProperties(Model): 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, } - def __init__(self, *, subject: str=None, ekus=None, subject_alternative_names=None, key_usage=None, validity_in_months: int=None, **kwargs) -> None: + def __init__( + self, + *, + subject: Optional[str] = None, + ekus: Optional[List[str]] = None, + subject_alternative_names: Optional["SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + validity_in_months: Optional[int] = None, + **kwargs + ): super(X509CertificateProperties, self).__init__(**kwargs) self.subject = subject self.ekus = ekus diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/__init__.py index 603e37d3ee0..44bfc9d07bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/__init__.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/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 ._key_vault_client_operations import KeyVaultClientOperationsMixin diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/_key_vault_client_operations.py index 449c73af3bb..1cfeee81d0b 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/operations/_key_vault_client_operations.py @@ -1,412 +1,451 @@ # 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 TYPE_CHECKING +import warnings -from azure.core.exceptions import map_error +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 .. import models -import uuid +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] class KeyVaultClientOperationsMixin(object): def get_certificates( - self, vault_base_url, maxresults=None, include_pending=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List certificates in a specified key vault. - The GetCertificates operation returns the set of certificates resources - in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificates.metadata['url'] + url = self.get_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificates.metadata = {'url': '/certificates'} - - def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + def delete_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Deletes a certificate from a specified key vault. - Deletes all versions of a certificate object along with its associated - policy. Delete certificate cannot be used to remove individual versions - of a certificate object. This operation requires the - certificates/delete permission. + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate.metadata['url'] + url = self.delete_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} - - def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, **kwargs): + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + def set_certificate_contacts( + self, + vault_base_url, # type: str + contact_list=None, # type: Optional[List["models.Contact"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Sets the certificate contacts for the specified key vault. - Sets the certificate contacts for the specified key vault. This - operation requires the certificates/managecontacts permission. + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param contact_list: The contact list for the vault certificates. :type contact_list: list[~azure.keyvault.v7_1.models.Contact] - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - contacts = models.Contacts(contact_list=contact_list) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_contacts.metadata['url'] + url = self.set_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(contacts, 'Contacts') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Lists the certificate contacts for a specified key vault. - The GetCertificateContacts operation returns the set of certificate - contact resources in the specified key vault. This operation requires - the certificates/managecontacts permission. + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_contacts.metadata['url'] + url = self.get_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_contacts.metadata = {'url': '/certificates/contacts'} - - def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def delete_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" """Deletes the certificate contacts for a specified key vault. - Deletes the certificate contacts for a specified key vault certificate. - This operation requires the certificates/managecontacts permission. + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: Contacts or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.Contacts - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_contacts.metadata['url'] + url = self.delete_certificate_contacts.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('Contacts', response) + deserialized = self._deserialize('Contacts', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore def get_certificate_issuers( - self, vault_base_url, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateIssuerListResult"] """List certificate issuers for a specified key vault. - The GetCertificateIssuers operation returns the set of certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateIssuerItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_issuers.metadata['url'] + url = self.get_certificate_issuers.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateIssuerListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_issuers.metadata = {'url': '/certificates/issuers'} - - def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + def set_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider, # type: str + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Sets the specified certificate issuer. - The SetCertificateIssuer operation adds or updates the specified - certificate issuer. This operation requires the certificates/setissuers - permission. + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -414,72 +453,78 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.set_certificate_issuer.metadata['url'] + url = self.set_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def update_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider=None, # type: Optional[str] + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Updates the specified certificate issuer. - The UpdateCertificateIssuer operation performs an update on the - specified certificate issuer entity. This operation requires the - certificates/setissuers permission. + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str @@ -487,4738 +532,1355 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, :type provider: str :param credentials: The credentials to be used for the issuer. :type credentials: ~azure.keyvault.v7_1.models.IssuerCredentials - :param organization_details: Details of the organization as provided - to the issuer. - :type organization_details: - ~azure.keyvault.v7_1.models.OrganizationDetails + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_1.models.OrganizationDetails :param attributes: Attributes of the issuer object. :type attributes: ~azure.keyvault.v7_1.models.IssuerAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_issuer.metadata['url'] + url = self.update_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct body - body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def get_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Lists the specified certificate issuer. - The GetCertificateIssuer operation returns the specified certificate - issuer resources in the specified key vault. This operation requires - the certificates/manageissuers/getissuers permission. + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_issuer.metadata['url'] + url = self.get_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs): + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def delete_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" """Deletes the specified certificate issuer. - The DeleteCertificateIssuer operation permanently removes the specified - certificate issuer from the vault. This operation requires the - certificates/manageissuers/deleteissuers permission. + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param issuer_name: The name of the issuer. :type issuer_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: IssuerBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.IssuerBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_issuer.metadata['url'] + url = self.delete_certificate_issuer.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'issuer-name': self._serialize.url("issuer_name", issuer_name, 'str') + 'issuer-name': self._serialize.url("issuer_name", issuer_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('IssuerBundle', response) + deserialized = self._deserialize('IssuerBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} - - def create_certificate(self, vault_base_url, certificate_name, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def create_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Creates a new certificate. - If this is the first version, the certificate resource is created. This - operation requires the certificates/create permission. + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.create_certificate.metadata['url'] + url = self.create_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateCreateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 202: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} - - def import_certificate(self, vault_base_url, certificate_name, base64_encoded_certificate, password=None, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + def import_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + base64_encoded_certificate, # type: str + password=None, # type: Optional[str] + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Imports a certificate into a specified key vault. - 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. If the certificate is in PEM format the PEM file must - contain the key as well as x509 certificates. This operation requires + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param base64_encoded_certificate: Base64 encoded representation of - the certificate object to import. This certificate needs to contain - the private key. + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. :type base64_encoded_certificate: str - :param password: If the private key in base64EncodedCertificate is - encrypted, the password used for encryption. + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. :type password: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.import_certificate.metadata['url'] + url = self.import_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateImportParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore def get_certificate_versions( - self, vault_base_url, certificate_name, maxresults=None, cls=None, **kwargs): + self, + vault_base_url, # type: str + certificate_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] """List the versions of a certificate. - The GetCertificateVersions operation returns the versions of a - certificate in the specified key vault. This operation requires the - certificates/list permission. + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :return: An iterator like instance of CertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_certificate_versions.metadata['url'] + url = self.get_certificate_versions.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('CertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} - - def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + def get_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Lists the policy for a certificate. - The GetCertificatePolicy operation returns the specified certificate - policy resources in the specified key vault. This operation requires - the certificates/get permission. + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in a given key - vault. + :param certificate_name: The name of the certificate in a given key vault. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_policy.metadata['url'] + url = self.get_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate_policy(self, vault_base_url, certificate_name, certificate_policy, cls=None, **kwargs): + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy, # type: "models.CertificatePolicy" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" """Updates the policy for a certificate. - Set specified members in the certificate policy. Leave others as null. - This operation requires the certificates/update permission. + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str :param certificate_policy: The policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificatePolicy or the result of cls(response) + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificatePolicy - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") + # Construct URL - url = self.update_certificate_policy.metadata['url'] + url = self.update_certificate_policy.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body + body_content_kwargs = {} # type: Dict[str, Any] body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificatePolicy', response) + deserialized = self._deserialize('CertificatePolicy', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} - - def update_certificate(self, vault_base_url, certificate_name, certificate_version, certificate_policy=None, certificate_attributes=None, tags=None, cls=None, **kwargs): + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Updates the specified attributes associated with the given certificate. - The UpdateCertificate operation applies the specified update on the - given certificate; the only elements updated are the certificate's - attributes. This operation requires the certificates/update permission. + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given key - vault. + :param certificate_name: The name of the certificate in the given key vault. :type certificate_name: str :param certificate_version: The version of the certificate. :type certificate_version: str :param certificate_policy: The management policy for the certificate. - :type certificate_policy: - ~azure.keyvault.v7_1.models.CertificatePolicy - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :type certificate_policy: ~azure.keyvault.v7_1.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate.metadata['url'] + url = self.update_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def get_certificate(self, vault_base_url, certificate_name, certificate_version, cls=None, **kwargs): + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def get_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Gets information about a certificate. - Gets information about a specific certificate. This operation requires - the certificates/get permission. + Gets information about a specific certificate. This operation requires the certificates/get + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate in the given - vault. + :param certificate_name: The name of the certificate in the given vault. :type certificate_name: str - :param certificate_version: The version of the certificate. + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. :type certificate_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate.metadata['url'] + url = self.get_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), - 'certificate-version': self._serialize.url("certificate_version", certificate_version, 'str') + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} - - def update_certificate_operation(self, vault_base_url, certificate_name, cancellation_requested, cls=None, **kwargs): + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def update_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + cancellation_requested, # type: bool + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Updates a certificate operation. - Updates a certificate creation operation that is already in progress. - This operation requires the certificates/update permission. + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param cancellation_requested: Indicates if cancellation was requested - on the certificate operation. + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. :type cancellation_requested: bool - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.update_certificate_operation.metadata['url'] + url = self.update_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def get_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Gets the creation operation of a certificate. - Gets the creation operation associated with a specified certificate. - This operation requires the certificates/get permission. + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_certificate_operation.metadata['url'] + url = self.get_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def delete_certificate_operation(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def delete_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" """Deletes the creation operation for a specific certificate. - Deletes the creation operation for a specified certificate that is in - the process of being created. The certificate is no longer created. - This operation requires the certificates/update permission. + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateOperation or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateOperation - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.delete_certificate_operation.metadata['url'] + url = self.delete_certificate_operation.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateOperation', response) + deserialized = self._deserialize('CertificateOperation', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} - - def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, certificate_attributes=None, tags=None, cls=None, **kwargs): - """Merges a certificate or a certificate chain with a key pair existing on - the server. - - The MergeCertificate operation performs the merging of a certificate or - certificate chain with a key pair currently available in the service. - This operation requires the certificates/create permission. + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def merge_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + x509_certificates, # type: List[bytearray] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param x509_certificates: The certificate or the certificate chain to - merge. + :param x509_certificates: The certificate or the certificate chain to merge. :type x509_certificates: list[bytearray] - :param certificate_attributes: The attributes of the certificate - (optional). - :type certificate_attributes: - ~azure.keyvault.v7_1.models.CertificateAttributes - :param tags: Application specific metadata in the form of key-value - pairs. + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_1.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.merge_certificate.metadata['url'] + url = self.merge_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateMergeParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 201: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} - - def backup_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + def backup_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupCertificateResult" """Backs up the specified certificate. - Requests that a backup of the specified certificate be downloaded to - the client. All versions of the certificate will be downloaded. This - operation requires the certificates/backup permission. + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupCertificateResult or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.BackupCertificateResult - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.backup_certificate.metadata['url'] + url = self.backup_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupCertificateResult', response) + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} - - def restore_certificate(self, vault_base_url, certificate_bundle_backup, cls=None, **kwargs): + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + def restore_certificate( + self, + vault_base_url, # type: str + certificate_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" """Restores a backed up certificate to a vault. - Restores a backed up certificate, and all its versions, to a vault. - This operation requires the certificates/restore permission. + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_bundle_backup: The backup blob associated with a - certificate bundle. + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. :type certificate_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.1-preview" + content_type = kwargs.pop("content_type", "application/json") # Construct URL - url = self.restore_certificate.metadata['url'] + url = self.restore_certificate.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } 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()) - # Construct body - body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - restore_certificate.metadata = {'url': '/certificates/restore'} + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore def get_deleted_certificates( - self, vault_base_url, maxresults=None, include_pending=None, cls=None, **kwargs): - """Lists the deleted certificates in the specified vault currently - available for recovery. - - The GetDeletedCertificates operation retrieves the certificates in the - current vault which are in a deleted state and ready for recovery or - purging. This operation includes deletion-specific information. This - operation requires the certificates/get/list permission. This operation - can only be enabled on soft-delete enabled vaults. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedCertificateListResult"] + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. :type maxresults: int - :param include_pending: Specifies whether to include certificates - which are not completely provisioned. + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. :type include_pending: bool - :return: An iterator like instance of DeletedCertificateItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateItem] - :raises: - :class:`KeyVaultErrorException` + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + def prepare_request(next_link=None): - query_parameters = {} + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + if not next_link: # Construct URL - url = self.get_deleted_certificates.metadata['url'] + url = self.get_deleted_certificates.metadata['url'] # type: ignore path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + request = self._client.get(url, query_parameters, header_parameters) else: url = next_link + query_parameters = {} # type: Dict[str, Any] path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), } url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) return request - def extract_data(response): - deserialized = self._deserialize('DeletedCertificateListResult', response) + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, **kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - return response + raise HttpResponseError(response=response, model=error) + + return pipeline_response - # Deserialize response return ItemPaged( get_next, extract_data ) - get_deleted_certificates.metadata = {'url': '/deletedcertificates'} - - def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + def get_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" """Retrieves information about the specified deleted certificate. - The GetDeletedCertificate operation retrieves the deleted certificate - information plus its attributes, such as retention interval, scheduled - permanent deletion and the current deletion recovery level. This - operation requires the certificates/get permission. + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedCertificateBundle or the result of cls(response) + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) :rtype: ~azure.keyvault.v7_1.models.DeletedCertificateBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" + # Construct URL - url = self.get_deleted_certificate.metadata['url'] + url = self.get_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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()) - # Construct and send request request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedCertificateBundle', response) + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def purge_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None """Permanently deletes the specified deleted certificate. - The PurgeDeletedCertificate operation performs an irreversible deletion - of the specified certificate, without possibility for recovery. The - operation is not available if the recovery level does not specify - 'Purgeable'. This operation requires the certificate/purge permission. + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param certificate_name: The name of the certificate + :param certificate_name: The name of the certificate. :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: None or the result of cls(response) + :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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_certificate.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} - - def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): - """Recovers the deleted certificate back to its current version under - /certificates. - - The RecoverDeletedCertificate 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 - (available in the deleted certificate's attributes). This operation - requires the certificates/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param certificate_name: The name of the deleted certificate - :type certificate_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: CertificateBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.CertificateBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_certificate.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('CertificateBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} - - def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, key_attributes=None, tags=None, curve=None, cls=None, **kwargs): - """Creates a new key, stores it, then returns key parameters and - attributes to the client. - - The create key operation can be used to create any key type in Azure - Key Vault. If the named key already exists, Azure Key Vault creates a - new version of the key. It requires the keys/create permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name for the new key. The system will generate - the version name for the new key. - :type key_name: str - :param kty: The type of key to create. For valid values, see - JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', - 'RSA-HSM', 'oct' - :type kty: str or ~azure.keyvault.v7_1.models.JsonWebKeyType - :param key_size: The key size in bits. For example: 2048, 3072, or - 4096 for RSA. - :type key_size: int - :param key_ops: - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param curve: Elliptic curve name. For valid values, see - JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384', - 'P-521', 'P-256K' - :type curve: str or ~azure.keyvault.v7_1.models.JsonWebKeyCurveName - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyCreateParameters(kty=kty, key_size=key_size, key_ops=key_ops, key_attributes=key_attributes, tags=tags, curve=curve) - - # Construct URL - url = self.create_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - create_key.metadata = {'url': '/keys/{key-name}/create'} - - def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=None, tags=None, cls=None, **kwargs): - """Imports an externally created key, stores it, and returns key - parameters and attributes to the client. - - The import key operation may be used to import any key type into an - Azure Key Vault. If the named key already exists, Azure Key Vault - creates a new version of the key. This operation requires the - keys/import permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: Name for the imported key. - :type key_name: str - :param key: The Json web key - :type key: ~azure.keyvault.v7_1.models.JsonWebKey - :param hsm: Whether to import as a hardware key (HSM) or software key. - :type hsm: bool - :param key_attributes: The key management attributes. - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyImportParameters(hsm=hsm, key=key, key_attributes=key_attributes, tags=tags) - - # Construct URL - url = self.import_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyImportParameters') + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - import_key.metadata = {'url': '/keys/{key-name}'} - - def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Deletes a key of any type from storage in Azure Key Vault. - - The delete key operation cannot be used to remove individual versions - of a key. This operation removes the cryptographic material associated - with the key, which means the key is not usable for Sign/Verify, - Wrap/Unwrap or Encrypt/Decrypt operations. This operation requires the - keys/delete permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key to delete. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) # Construct URL - url = self.delete_key.metadata['url'] + url = self.purge_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + header_parameters = {} # type: Dict[str, Any] - # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, None, {}) - return deserialized - delete_key.metadata = {'url': '/keys/{key-name}'} + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore - def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_attributes=None, tags=None, cls=None, **kwargs): - """The update key operation changes specified attributes of a stored key - and can be applied to any key type and key version stored in Azure Key - Vault. + def recover_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Recovers the deleted certificate back to its current version under /certificates. - In order to perform this operation, the key must already exist in the - Key Vault. Note: The cryptographic material of a key itself cannot be - changed. This operation requires the keys/update permission. + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. :type vault_base_url: str - :param key_name: The name of key to update. - :type key_name: str - :param key_version: The version of the key to update. - :type key_version: str - :param key_ops: Json web key operations. For more information on - possible key operations, see JsonWebKeyOperation. - :type key_ops: list[str or - ~azure.keyvault.v7_1.models.JsonWebKeyOperation] - :param key_attributes: - :type key_attributes: ~azure.keyvault.v7_1.models.KeyAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_1.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyUpdateParameters(key_ops=key_ops, key_attributes=key_attributes, tags=tags) + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.1-preview" # Construct URL - url = self.update_key.metadata['url'] + url = self.recover_deleted_certificate.metadata['url'] # type: ignore path_format_arguments = { 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') + 'certificate-name': self._serialize.url("certificate_name", certificate_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' - 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()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - update_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): - """Gets the public part of a stored key. - - The get key operation is applicable to all key types. If the requested - key is symmetric, then no key material is released in the response. - This operation requires the keys/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key to get. - :type key_name: str - :param key_version: Adding the version parameter retrieves a specific - version of a key. - :type key_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_key.metadata = {'url': '/keys/{key-name}/{key-version}'} - - def get_key_versions( - self, vault_base_url, key_name, maxresults=None, cls=None, **kwargs): - """Retrieves a list of individual key versions with the same key name. - - The full key identifier, attributes, and tags are provided in the - response. This operation requires the keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_key_versions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} - - def get_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """List keys in the specified vault. - - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a stored key. The LIST - operation is applicable to all key types, however only the base key - identifier, attributes, and tags are provided in the response. - Individual versions of a key are not listed in the response. This - operation requires the keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of KeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.KeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_keys.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('KeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_keys.metadata = {'url': '/keys'} - - def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Requests that a backup of the specified key be downloaded to the - client. - - The Key Backup operation exports a key from Azure Key Vault in a - protected form. Note that this operation does NOT return key material - in a form that can be used outside the Azure Key Vault system, the - returned key material is either protected to a Azure Key Vault HSM or - to Azure Key Vault itself. The intent of this operation is to allow a - client to GENERATE a key in one Azure Key Vault instance, BACKUP the - key, and then RESTORE it into another Azure Key Vault instance. The - BACKUP operation may be used to export, in protected form, any key type - from Azure Key Vault. Individual versions of a key cannot be backed up. - BACKUP / RESTORE can be performed within geographical boundaries only; - meaning that a BACKUP from one geographical area cannot be restored to - another geographical area. For example, a backup from the US - geographical area cannot be restored in an EU geographical area. This - operation requires the key/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupKeyResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupKeyResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupKeyResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_key.metadata = {'url': '/keys/{key-name}/backup'} - - def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): - """Restores a backed up key to a vault. - - Imports a previously backed up key into Azure Key Vault, restoring the - key, its key identifier, attributes and access control policies. The - RESTORE operation may be used to import a previously backed up key. - Individual versions of a key cannot be restored. The key is restored in - its entirety with the same key name as it had when it was backed up. If - the key name is not available in the target Key Vault, the RESTORE - operation will be rejected. While the key name is retained during - restore, the final key identifier will change if the key is restored to - a different vault. Restore will restore all versions and preserve - version identifiers. The RESTORE operation is subject to security - constraints: The target Key Vault must be owned by the same Microsoft - Azure Subscription as the source Key Vault The user must have RESTORE - permission in the target Key Vault. This operation requires the - keys/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_bundle_backup: The backup blob associated with a key - bundle. - :type key_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyRestoreParameters(key_bundle_backup=key_bundle_backup) - - # Construct URL - url = self.restore_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_key.metadata = {'url': '/keys/restore'} - - def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Encrypts an arbitrary sequence of bytes using an encryption key that is - stored in a key vault. - - The ENCRYPT operation encrypts an arbitrary sequence of bytes using an - encryption key that is stored in Azure Key Vault. Note that the ENCRYPT - operation only supports a single block of data, the size of which is - dependent on the target key and the encryption algorithm to be used. - The ENCRYPT operation is only strictly necessary for symmetric keys - stored in Azure Key Vault since protection with an asymmetric key can - be performed using public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/encrypt permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.encrypt.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - encrypt.metadata = {'url': '/keys/{key-name}/{key-version}/encrypt'} - - def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Decrypts a single block of encrypted data. - - The DECRYPT operation decrypts a well-formed block of ciphertext using - the target encryption key and specified algorithm. This operation is - the reverse of the ENCRYPT operation; only a single block of data may - be decrypted, the size of this block is dependent on the target key and - the algorithm to be used. The DECRYPT operation applies to asymmetric - and symmetric keys stored in Azure Key Vault since it uses the private - portion of the key. This operation requires the keys/decrypt - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.decrypt.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - decrypt.metadata = {'url': '/keys/{key-name}/{key-version}/decrypt'} - - def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Creates a signature from a digest using the specified key. - - The SIGN operation is applicable to asymmetric and symmetric keys - stored in Azure Key Vault since this operation uses the private portion - of the key. This operation requires the keys/sign permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: The signing/verification algorithm identifier. For - more information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeySignParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.sign.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeySignParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - sign.metadata = {'url': '/keys/{key-name}/{key-version}/sign'} - - def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signature, cls=None, **kwargs): - """Verifies a signature using a specified key. - - The VERIFY operation is applicable to symmetric keys stored in Azure - Key Vault. VERIFY is not strictly necessary for asymmetric keys stored - in Azure Key Vault since signature verification can be performed using - the public portion of the key but this operation is supported as a - convenience for callers that only have a key-reference and not the - public portion of the key. This operation requires the keys/verify - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: The signing/verification algorithm. For more - information on possible algorithm types, see - JsonWebKeySignatureAlgorithm. Possible values include: 'PS256', - 'PS384', 'PS512', 'RS256', 'RS384', 'RS512', 'RSNULL', 'ES256', - 'ES384', 'ES512', 'ES256K' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeySignatureAlgorithm - :param digest: The digest used for signing. - :type digest: bytes - :param signature: The signature to be verified. - :type signature: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyVerifyResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyVerifyResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyVerifyParameters(algorithm=algorithm, digest=digest, signature=signature) - - # Construct URL - url = self.verify.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyVerifyParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyVerifyResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - verify.metadata = {'url': '/keys/{key-name}/{key-version}/verify'} - - def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Wraps a symmetric key using a specified key. - - The WRAP operation supports encryption of a symmetric key using a key - encryption key that has previously been stored in an Azure Key Vault. - The WRAP operation is only strictly necessary for symmetric keys stored - in Azure Key Vault since protection with an asymmetric key can be - performed using the public portion of the key. This operation is - supported for asymmetric keys as a convenience for callers that have a - key-reference but do not have access to the public key material. This - operation requires the keys/wrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.wrap_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - wrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/wrapkey'} - - def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls=None, **kwargs): - """Unwraps a symmetric key using the specified key that was initially used - for wrapping that key. - - The UNWRAP operation supports decryption of a symmetric key using the - target key encryption key. This operation is the reverse of the WRAP - operation. The UNWRAP operation applies to asymmetric and symmetric - keys stored in Azure Key Vault since it uses the private portion of the - key. This operation requires the keys/unwrapKey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param key_version: The version of the key. - :type key_version: str - :param algorithm: algorithm identifier. Possible values include: - 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' - :type algorithm: str or - ~azure.keyvault.v7_1.models.JsonWebKeyEncryptionAlgorithm - :param value: - :type value: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyOperationResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyOperationResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.KeyOperationsParameters(algorithm=algorithm, value=value) - - # Construct URL - url = self.unwrap_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str'), - 'key-version': self._serialize.url("key_version", key_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'KeyOperationsParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyOperationResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - unwrap_key.metadata = {'url': '/keys/{key-name}/{key-version}/unwrapkey'} - - def get_deleted_keys( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """Lists the deleted keys in the specified vault. - - Retrieves a list of the keys in the Key Vault as JSON Web Key - structures that contain the public part of a deleted key. This - operation includes deletion-specific information. The Get Deleted Keys - operation is applicable for vaults enabled for soft-delete. While the - operation can be invoked on any vault, it will return an error if - invoked on a non soft-delete enabled vault. This operation requires the - keys/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedKeyItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedKeyItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_keys.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('DeletedKeyListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_deleted_keys.metadata = {'url': '/deletedkeys'} - - def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Gets the public part of a deleted key. - - The Get Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/get permission. . - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedKeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedKeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedKeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Permanently deletes the specified key. - - The Purge Deleted Key operation is applicable for soft-delete enabled - vaults. While the operation can be invoked on any vault, it will return - an error if invoked on a non soft-delete enabled vault. This operation - requires the keys/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the key - :type key_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_key.metadata = {'url': '/deletedkeys/{key-name}'} - - def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): - """Recovers the deleted key to its latest version. - - The Recover Deleted Key operation is applicable for deleted keys in - soft-delete enabled vaults. It recovers the deleted key back to its - latest version under /keys. An attempt to recover an non-deleted key - will return an error. Consider this the inverse of the delete operation - on soft-delete enabled vaults. This operation requires the keys/recover - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param key_name: The name of the deleted key. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: KeyBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.KeyBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'key-name': self._serialize.url("key_name", key_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('KeyBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_key.metadata = {'url': '/deletedkeys/{key-name}/recover'} - - def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type=None, secret_attributes=None, cls=None, **kwargs): - """Sets a secret in a specified key vault. - - The SET operation adds a secret to the Azure Key Vault. If the named - secret already exists, Azure Key Vault creates a new version of that - secret. This operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param value: The value of the secret. - :type value: str - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretSetParameters(value=value, tags=tags, content_type=content_type, secret_attributes=secret_attributes) - - # Construct URL - url = self.set_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[0-9a-zA-Z-]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretSetParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_secret.metadata = {'url': '/secrets/{secret-name}'} - - def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): - """Deletes a secret from a specified key vault. - - The DELETE operation applies to any secret stored in Azure Key Vault. - DELETE cannot be applied to an individual version of a secret. This - operation requires the secrets/delete permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_secret.metadata = {'url': '/secrets/{secret-name}'} - - def update_secret(self, vault_base_url, secret_name, secret_version, content_type=None, secret_attributes=None, tags=None, cls=None, **kwargs): - """Updates the attributes associated with a specified secret in a given - key vault. - - The UPDATE operation changes specified attributes of an existing stored - secret. Attributes that are not specified in the request are left - unchanged. The value of a secret itself cannot be changed. This - operation requires the secrets/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param secret_version: The version of the secret. - :type secret_version: str - :param content_type: Type of the secret value such as a password. - :type content_type: str - :param secret_attributes: The secret management attributes. - :type secret_attributes: ~azure.keyvault.v7_1.models.SecretAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretUpdateParameters(content_type=content_type, secret_attributes=secret_attributes, tags=tags) - - # Construct URL - url = self.update_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - update_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kwargs): - """Get a specified secret from a given key vault. - - The GET operation is applicable to any secret stored in Azure Key - Vault. This operation requires the secrets/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param secret_version: The version of the secret. - :type secret_version: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str'), - 'secret-version': self._serialize.url("secret_version", secret_version, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_secret.metadata = {'url': '/secrets/{secret-name}/{secret-version}'} - - def get_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """List secrets in a specified key vault. - - The Get Secrets operation is applicable to the entire vault. However, - only the base secret identifier and its attributes are provided in the - response. Individual secret versions are not listed in the response. - This operation requires the secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_secrets.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_secrets.metadata = {'url': '/secrets'} - - def get_secret_versions( - self, vault_base_url, secret_name, maxresults=None, cls=None, **kwargs): - """List all versions of the specified secret. - - The full secret identifier and attributes are provided in the response. - No values are returned for the secrets. This operations requires the - secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified, the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_secret_versions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('SecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} - - def get_deleted_secrets( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """Lists deleted secrets for the specified vault. - - The Get Deleted Secrets operation returns the secrets that have been - deleted for a vault enabled for soft-delete. This operation requires - the secrets/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedSecretItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedSecretItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_secrets.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('DeletedSecretListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_deleted_secrets.metadata = {'url': '/deletedsecrets'} - - def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): - """Gets the specified deleted secret. - - The Get Deleted Secret operation returns the specified deleted secret - along with its attributes. This operation requires the secrets/get - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): - """Permanently deletes the specified secret. - - The purge deleted secret operation removes the secret permanently, - without the possibility of recovery. This operation can only be enabled - on a soft-delete enabled vault. This operation requires the - secrets/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}'} - - def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): - """Recovers the deleted secret to the latest version. - - Recovers the deleted secret in the specified vault. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the secrets/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the deleted secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_secret.metadata = {'url': '/deletedsecrets/{secret-name}/recover'} - - def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): - """Backs up the specified secret. - - Requests that a backup of the specified secret be downloaded to the - client. All versions of the secret will be downloaded. This operation - requires the secrets/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_name: The name of the secret. - :type secret_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupSecretResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupSecretResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'secret-name': self._serialize.url("secret_name", secret_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupSecretResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_secret.metadata = {'url': '/secrets/{secret-name}/backup'} - - def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwargs): - """Restores a backed up secret to a vault. - - Restores a backed up secret, and all its versions, to a vault. This - operation requires the secrets/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param secret_bundle_backup: The backup blob associated with a secret - bundle. - :type secret_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: SecretBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SecretBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SecretRestoreParameters(secret_bundle_backup=secret_bundle_backup) - - # Construct URL - url = self.restore_secret.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SecretRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SecretBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_secret.metadata = {'url': '/secrets/restore'} - - def get_storage_accounts( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """List storage accounts managed by the specified key vault. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of StorageAccountItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.StorageAccountItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_storage_accounts.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('StorageListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_storage_accounts.metadata = {'url': '/storage'} - - def get_deleted_storage_accounts( - self, vault_base_url, maxresults=None, cls=None, **kwargs): - """Lists deleted storage accounts for the specified vault. - - The Get Deleted Storage Accounts operation returns the storage accounts - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/list permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedStorageAccountItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedStorageAccountItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_storage_accounts.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('DeletedStorageListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} - - def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Gets the specified deleted storage account. - - The Get Deleted Storage Account operation returns the specified deleted - storage account along with its attributes. This operation requires the - storage/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - def purge_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Permanently deletes the specified storage account. - - The purge deleted storage account operation removes the secret - permanently, without the possibility of recovery. This operation can - only be performed on a soft-delete enabled vault. This operation - requires the storage/purge permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param 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: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.purge_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - if cls: - response_headers = {} - return cls(response, None, response_headers) - purge_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}'} - - def recover_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Recovers the deleted storage account. - - Recovers the deleted storage account in the specified vault. This - operation can only be performed on a soft-delete enabled vault. This - operation requires the storage/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_storage_account.metadata = {'url': '/deletedstorage/{storage-account-name}/recover'} - - def backup_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Backs up the specified storage account. - - Requests that a backup of the specified storage account be downloaded - to the client. This operation requires the storage/backup permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: BackupStorageResult or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.BackupStorageResult - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.backup_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('BackupStorageResult', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - backup_storage_account.metadata = {'url': '/storage/{storage-account-name}/backup'} - - def restore_storage_account(self, vault_base_url, storage_bundle_backup, cls=None, **kwargs): - """Restores a backed up storage account to a vault. - - Restores a backed up storage account to a vault. This operation - requires the storage/restore permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_bundle_backup: The backup blob associated with a - storage account. - :type storage_bundle_backup: bytes - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageRestoreParameters(storage_bundle_backup=storage_bundle_backup) - - # Construct URL - url = self.restore_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageRestoreParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - restore_storage_account.metadata = {'url': '/storage/restore'} - - def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Deletes a storage account. This operation requires the storage/delete - permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedStorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedStorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedStorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def get_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): - """Gets information about a specified storage account. This operation - requires the storage/get permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def set_storage_account(self, vault_base_url, storage_account_name, resource_id, active_key_name, auto_regenerate_key, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new storage account. This operation requires the - storage/set permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param resource_id: Storage account resource id. - :type resource_id: str - :param active_key_name: Current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountCreateParameters(resource_id=resource_id, active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) - - # Construct URL - url = self.set_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def update_storage_account(self, vault_base_url, storage_account_name, active_key_name=None, auto_regenerate_key=None, regeneration_period=None, storage_account_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given storage - account. This operation requires the storage/set/update permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param active_key_name: The current active storage account key name. - :type active_key_name: str - :param auto_regenerate_key: whether keyvault should manage the storage - account for the user. - :type auto_regenerate_key: bool - :param regeneration_period: The key regeneration time duration - specified in ISO-8601 format. - :type regeneration_period: str - :param storage_account_attributes: The attributes of the storage - account. - :type storage_account_attributes: - ~azure.keyvault.v7_1.models.StorageAccountAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountUpdateParameters(active_key_name=active_key_name, auto_regenerate_key=auto_regenerate_key, regeneration_period=regeneration_period, storage_account_attributes=storage_account_attributes, tags=tags) - - # Construct URL - url = self.update_storage_account.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - update_storage_account.metadata = {'url': '/storage/{storage-account-name}'} - - def regenerate_storage_account_key(self, vault_base_url, storage_account_name, key_name, cls=None, **kwargs): - """Regenerates the specified key value for the given storage account. This - operation requires the storage/regeneratekey permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param key_name: The storage account key name. - :type key_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: StorageBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.StorageBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.StorageAccountRegenerteKeyParameters(key_name=key_name) - - # Construct URL - url = self.regenerate_storage_account_key.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') - - # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('StorageBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - regenerate_storage_account_key.metadata = {'url': '/storage/{storage-account-name}/regeneratekey'} - - def get_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, cls=None, **kwargs): - """List storage SAS definitions for the given storage account. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of SasDefinitionItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.SasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_sas_definitions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('SasDefinitionListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} - - def get_deleted_sas_definitions( - self, vault_base_url, storage_account_name, maxresults=None, cls=None, **kwargs): - """Lists deleted SAS definitions for the specified vault and storage - account. - - The Get Deleted Sas Definitions operation returns the SAS definitions - that have been deleted for a vault enabled for soft-delete. This - operation requires the storage/listsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param maxresults: Maximum number of results to return in a page. If - not specified the service will return up to 25 results. - :type maxresults: int - :return: An iterator like instance of DeletedSasDefinitionItem - :rtype: - ~azure.core.paging.ItemPaged[~azure.keyvault.v7_1.models.DeletedSasDefinitionItem] - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - def prepare_request(next_link=None): - query_parameters = {} - if not next_link: - # Construct URL - url = self.get_deleted_sas_definitions.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - if maxresults is not None: - query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - else: - url = next_link - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(response): - deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, **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 models.KeyVaultErrorException(response, self._deserialize) - return response - - # Deserialize response - return ItemPaged( - get_next, extract_data - ) - get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} - - def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Gets the specified deleted sas definition. - - The Get Deleted SAS Definition operation returns the specified deleted - SAS definition along with its attributes. This operation requires the - storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_deleted_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}'} - - def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Recovers the deleted SAS definition. - - Recovers the deleted SAS definition for the specified storage account. - This operation can only be performed on a soft-delete enabled vault. - This operation requires the storage/recover permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.recover_deleted_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - recover_deleted_sas_definition.metadata = {'url': '/deletedstorage/{storage-account-name}/sas/{sas-definition-name}/recover'} - - def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Deletes a SAS definition from a specified storage account. This - operation requires the storage/deletesas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: DeletedSasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.DeletedSasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.delete_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DeletedSasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - delete_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def get_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): - """Gets information about a SAS definition for the specified storage - account. This operation requires the storage/getsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - # Construct URL - url = self.get_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - get_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def set_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri, sas_type, validity_period, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Creates or updates a new SAS definition for the specified storage - account. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionCreateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) - - # Construct URL - url = self.set_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') - - # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) - - if cls: - return cls(response, deserialized, None) - - return deserialized - set_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} - - def update_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, template_uri=None, sas_type=None, validity_period=None, sas_definition_attributes=None, tags=None, cls=None, **kwargs): - """Updates the specified attributes associated with the given SAS - definition. This operation requires the storage/setsas permission. - - :param vault_base_url: The vault name, for example - https://myvault.vault.azure.net. - :type vault_base_url: str - :param storage_account_name: The name of the storage account. - :type storage_account_name: str - :param sas_definition_name: The name of the SAS definition. - :type sas_definition_name: str - :param template_uri: The SAS definition token template signed with an - arbitrary key. Tokens created according to the SAS definition will - have the same properties as the template. - :type template_uri: str - :param sas_type: The type of SAS token the SAS definition will create. - Possible values include: 'account', 'service' - :type sas_type: str or ~azure.keyvault.v7_1.models.SasTokenType - :param validity_period: The validity period of SAS tokens created - according to the SAS definition. - :type validity_period: str - :param sas_definition_attributes: The attributes of the SAS - definition. - :type sas_definition_attributes: - ~azure.keyvault.v7_1.models.SasDefinitionAttributes - :param tags: Application specific metadata in the form of key-value - pairs. - :type tags: dict[str, str] - :param callable cls: A custom type or function that will be passed the - direct response - :return: SasDefinitionBundle or the result of cls(response) - :rtype: ~azure.keyvault.v7_1.models.SasDefinitionBundle - :raises: - :class:`KeyVaultErrorException` - """ - error_map = kwargs.pop('error_map', None) - parameters = models.SasDefinitionUpdateParameters(template_uri=template_uri, sas_type=sas_type, validity_period=validity_period, sas_definition_attributes=sas_definition_attributes, tags=tags) - - # Construct URL - url = self.update_sas_definition.metadata['url'] - path_format_arguments = { - 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), - 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$'), - 'sas-definition-name': self._serialize.url("sas_definition_name", sas_definition_name, 'str', pattern=r'^[0-9a-zA-Z]+$') - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - - # Construct headers - header_parameters = {} - header_parameters['Accept'] = 'application/json' - header_parameters['Content-Type'] = 'application/json; charset=utf-8' - if self._config.generate_client_request_id: - header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - - # Construct body - body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') - - # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SasDefinitionBundle', response) + deserialized = self._deserialize('CertificateBundle', pipeline_response) if cls: - return cls(response, deserialized, None) + return cls(pipeline_response, deserialized, {}) return deserialized - update_sas_definition.metadata = {'url': '/storage/{storage-account-name}/sas/{sas-definition-name}'} + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/py.typed b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/__init__.py new file mode 100644 index 00000000000..a6c1f9b7a79 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/__init__.py @@ -0,0 +1,16 @@ +# 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_client import KeyVaultClient +__all__ = ['KeyVaultClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_configuration.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_configuration.py new file mode 100644 index 00000000000..23f42cba553 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_configuration.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +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 + +VERSION = "unknown" + +class KeyVaultClientConfiguration(Configuration): + """Configuration for KeyVaultClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + """ + + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None + super(KeyVaultClientConfiguration, self).__init__(**kwargs) + + self.api_version = "7.2-preview" + kwargs.setdefault('sdk_moniker', '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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_key_vault_client.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_key_vault_client.py new file mode 100644 index 00000000000..d9db79ab878 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_key_vault_client.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core import PipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + +from ._configuration import KeyVaultClientConfiguration +from .operations import KeyVaultClientOperationsMixin +from . import models + + +class KeyVaultClient(KeyVaultClientOperationsMixin): + """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + **kwargs # type: Any + ): + # type: (...) -> None + base_url = '{vaultBaseUrl}' + self._config = KeyVaultClientConfiguration(**kwargs) + self._client = PipelineClient(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) + + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_metadata.json b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_metadata.json new file mode 100644 index 00000000000..dad02a3f6f0 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/_metadata.json @@ -0,0 +1,357 @@ +{ + "chosen_version": "7.2-preview", + "total_api_version_list": ["7.2-preview"], + "client": { + "name": "KeyVaultClient", + "filename": "_key_vault_client", + "description": "The key vault client performs cryptographic key operations and vault operations against the Key Vault service.", + "base_url": null, + "custom_base_url": "\u0027{vaultBaseUrl}\u0027", + "azure_arm": false + }, + "global_parameters": { + "sync_method": { + }, + "async_method": { + }, + "constant": { + }, + "call": "" + }, + "config": { + "credential": false, + "credential_scopes": null, + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true + }, + "operation_groups": { + }, + "operation_mixins": { + "get_certificates" : { + "sync": { + "signature": "def get_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List certificates in a specified key vault.\n\nThe GetCertificates operation returns the set of certificates resources in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "delete_certificate" : { + "sync": { + "signature": "def delete_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Deletes a certificate from a specified key vault.\n\nDeletes all versions of a certificate object along with its associated policy. Delete\ncertificate cannot be used to remove individual versions of a certificate object. This\noperation requires the certificates/delete permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "set_certificate_contacts" : { + "sync": { + "signature": "def set_certificate_contacts(\n self,\n vault_base_url, # type: str\n contact_list=None, # type: Optional[List[\"models.Contact\"]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_2.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_contacts(\n self,\n vault_base_url: str,\n contact_list: Optional[List[\"models.Contact\"]] = None,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Sets the certificate contacts for the specified key vault.\n\nSets the certificate contacts for the specified key vault. This operation requires the\ncertificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param contact_list: The contact list for the vault certificates.\n:type contact_list: list[~azure.keyvault.v7_2.models.Contact]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, contact_list" + }, + "get_certificate_contacts" : { + "sync": { + "signature": "def get_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Lists the certificate contacts for a specified key vault.\n\nThe GetCertificateContacts operation returns the set of certificate contact resources in the\nspecified key vault. This operation requires the certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "delete_certificate_contacts" : { + "sync": { + "signature": "def delete_certificate_contacts(\n self,\n vault_base_url, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_contacts(\n self,\n vault_base_url: str,\n **kwargs\n) -\u003e \"models.Contacts\":\n", + "doc": "\"\"\"Deletes the certificate contacts for a specified key vault.\n\nDeletes the certificate contacts for a specified key vault certificate. This operation requires\nthe certificates/managecontacts permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Contacts, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.Contacts\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url" + }, + "get_certificate_issuers" : { + "sync": { + "signature": "def get_certificate_issuers(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_issuers(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateIssuerListResult\"]:\n", + "doc": "\"\"\"List certificate issuers for a specified key vault.\n\nThe GetCertificateIssuers operation returns the set of certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults" + }, + "set_certificate_issuer" : { + "sync": { + "signature": "def set_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider, # type: str\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def set_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: str,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Sets the specified certificate issuer.\n\nThe SetCertificateIssuer operation adds or updates the specified certificate issuer. This\noperation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "update_certificate_issuer" : { + "sync": { + "signature": "def update_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n provider=None, # type: Optional[str]\n credentials=None, # type: Optional[\"models.IssuerCredentials\"]\n organization_details=None, # type: Optional[\"models.OrganizationDetails\"]\n attributes=None, # type: Optional[\"models.IssuerAttributes\"]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n provider: Optional[str] = None,\n credentials: Optional[\"models.IssuerCredentials\"] = None,\n organization_details: Optional[\"models.OrganizationDetails\"] = None,\n attributes: Optional[\"models.IssuerAttributes\"] = None,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Updates the specified certificate issuer.\n\nThe UpdateCertificateIssuer operation performs an update on the specified certificate issuer\nentity. This operation requires the certificates/setissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:param provider: The issuer provider.\n:type provider: str\n:param credentials: The credentials to be used for the issuer.\n:type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials\n:param organization_details: Details of the organization as provided to the issuer.\n:type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails\n:param attributes: Attributes of the issuer object.\n:type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name, provider, credentials, organization_details, attributes" + }, + "get_certificate_issuer" : { + "sync": { + "signature": "def get_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Lists the specified certificate issuer.\n\nThe GetCertificateIssuer operation returns the specified certificate issuer resources in the\nspecified key vault. This operation requires the certificates/manageissuers/getissuers\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "delete_certificate_issuer" : { + "sync": { + "signature": "def delete_certificate_issuer(\n self,\n vault_base_url, # type: str\n issuer_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_issuer(\n self,\n vault_base_url: str,\n issuer_name: str,\n **kwargs\n) -\u003e \"models.IssuerBundle\":\n", + "doc": "\"\"\"Deletes the specified certificate issuer.\n\nThe DeleteCertificateIssuer operation permanently removes the specified certificate issuer from\nthe vault. This operation requires the certificates/manageissuers/deleteissuers permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param issuer_name: The name of the issuer.\n:type issuer_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: IssuerBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.IssuerBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, issuer_name" + }, + "create_certificate" : { + "sync": { + "signature": "def create_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def create_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Creates a new certificate.\n\nIf this is the first version, the certificate resource is created. This operation requires the\ncertificates/create permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy, certificate_attributes, tags" + }, + "import_certificate" : { + "sync": { + "signature": "def import_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n base64_encoded_certificate, # type: str\n password=None, # type: Optional[str]\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def import_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n base64_encoded_certificate: str,\n password: Optional[str] = None,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Imports a certificate into a specified key vault.\n\nImports an existing valid certificate, containing a private key, into Azure Key Vault. The\ncertificate to be imported can be in either PFX or PEM format. If the certificate is in PEM\nformat the PEM file must contain the key as well as x509 certificates. This operation requires\nthe certificates/import permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param base64_encoded_certificate: Base64 encoded representation of the certificate object to\n import. This certificate needs to contain the private key.\n:type base64_encoded_certificate: str\n:param password: If the private key in base64EncodedCertificate is encrypted, the password used\n for encryption.\n:type password: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, base64_encoded_certificate, password, certificate_policy, certificate_attributes, tags" + }, + "get_certificate_versions" : { + "sync": { + "signature": "def get_certificate_versions(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n maxresults=None, # type: Optional[int]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_certificate_versions(\n self,\n vault_base_url: str,\n certificate_name: str,\n maxresults: Optional[int] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.CertificateListResult\"]:\n", + "doc": "\"\"\"List the versions of a certificate.\n\nThe GetCertificateVersions operation returns the versions of a certificate in the specified key\nvault. This operation requires the certificates/list permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either CertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, maxresults" + }, + "get_certificate_policy" : { + "sync": { + "signature": "def get_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Lists the policy for a certificate.\n\nThe GetCertificatePolicy operation returns the specified certificate policy resources in the\nspecified key vault. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in a given key vault.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "update_certificate_policy" : { + "sync": { + "signature": "def update_certificate_policy(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_policy, # type: \"models.CertificatePolicy\"\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_policy(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_policy: \"models.CertificatePolicy\",\n **kwargs\n) -\u003e \"models.CertificatePolicy\":\n", + "doc": "\"\"\"Updates the policy for a certificate.\n\nSet specified members in the certificate policy. Leave others as null. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_policy: The policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificatePolicy, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificatePolicy\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_policy" + }, + "update_certificate" : { + "sync": { + "signature": "def update_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n certificate_policy=None, # type: Optional[\"models.CertificatePolicy\"]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n certificate_policy: Optional[\"models.CertificatePolicy\"] = None,\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Updates the specified attributes associated with the given certificate.\n\nThe UpdateCertificate operation applies the specified update on the given certificate; the only\nelements updated are the certificate\u0027s attributes. This operation requires the\ncertificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given key vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate.\n:type certificate_version: str\n:param certificate_policy: The management policy for the certificate.\n:type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version, certificate_policy, certificate_attributes, tags" + }, + "get_certificate" : { + "sync": { + "signature": "def get_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n certificate_version, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n certificate_version: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Gets information about a certificate.\n\nGets information about a specific certificate. This operation requires the certificates/get\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate in the given vault.\n:type certificate_name: str\n:param certificate_version: The version of the certificate. This URI fragment is optional. If\n not specified, the latest version of the certificate is returned.\n:type certificate_version: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, certificate_version" + }, + "update_certificate_operation" : { + "sync": { + "signature": "def update_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n cancellation_requested, # type: bool\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def update_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n cancellation_requested: bool,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Updates a certificate operation.\n\nUpdates a certificate creation operation that is already in progress. This operation requires\nthe certificates/update permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param cancellation_requested: Indicates if cancellation was requested on the certificate\n operation.\n:type cancellation_requested: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, cancellation_requested" + }, + "get_certificate_operation" : { + "sync": { + "signature": "def get_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Gets the creation operation of a certificate.\n\nGets the creation operation associated with a specified certificate. This operation requires\nthe certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "delete_certificate_operation" : { + "sync": { + "signature": "def delete_certificate_operation(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def delete_certificate_operation(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateOperation\":\n", + "doc": "\"\"\"Deletes the creation operation for a specific certificate.\n\nDeletes the creation operation for a specified certificate that is in the process of being\ncreated. The certificate is no longer created. This operation requires the certificates/update\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateOperation, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateOperation\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "merge_certificate" : { + "sync": { + "signature": "def merge_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n x509_certificates, # type: List[bytearray]\n certificate_attributes=None, # type: Optional[\"models.CertificateAttributes\"]\n tags=None, # type: Optional[Dict[str, str]]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def merge_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n x509_certificates: List[bytearray],\n certificate_attributes: Optional[\"models.CertificateAttributes\"] = None,\n tags: Optional[Dict[str, str]] = None,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Merges a certificate or a certificate chain with a key pair existing on the server.\n\nThe MergeCertificate operation performs the merging of a certificate or certificate chain with\na key pair currently available in the service. This operation requires the certificates/create\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:param x509_certificates: The certificate or the certificate chain to merge.\n:type x509_certificates: list[bytearray]\n:param certificate_attributes: The attributes of the certificate (optional).\n:type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes\n:param tags: Application specific metadata in the form of key-value pairs.\n:type tags: dict[str, str]\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name, x509_certificates, certificate_attributes, tags" + }, + "backup_certificate" : { + "sync": { + "signature": "def backup_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def backup_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.BackupCertificateResult\":\n", + "doc": "\"\"\"Backs up the specified certificate.\n\nRequests that a backup of the specified certificate be downloaded to the client. All versions\nof the certificate will be downloaded. This operation requires the certificates/backup\npermission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: BackupCertificateResult, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "restore_certificate" : { + "sync": { + "signature": "def restore_certificate(\n self,\n vault_base_url, # type: str\n certificate_bundle_backup, # type: bytes\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def restore_certificate(\n self,\n vault_base_url: str,\n certificate_bundle_backup: bytes,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Restores a backed up certificate to a vault.\n\nRestores a backed up certificate, and all its versions, to a vault. This operation requires the\ncertificates/restore permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_bundle_backup: The backup blob associated with a certificate bundle.\n:type certificate_bundle_backup: bytes\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_bundle_backup" + }, + "get_deleted_certificates" : { + "sync": { + "signature": "def get_deleted_certificates(\n self,\n vault_base_url, # type: str\n maxresults=None, # type: Optional[int]\n include_pending=None, # type: Optional[bool]\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": false, + "signature": "def get_deleted_certificates(\n self,\n vault_base_url: str,\n maxresults: Optional[int] = None,\n include_pending: Optional[bool] = None,\n **kwargs\n) -\u003e AsyncItemPaged[\"models.DeletedCertificateListResult\"]:\n", + "doc": "\"\"\"Lists the deleted certificates in the specified vault currently available for recovery.\n\nThe GetDeletedCertificates operation retrieves the certificates in the current vault which are\nin a deleted state and ready for recovery or purging. This operation includes deletion-specific\ninformation. This operation requires the certificates/get/list permission. This operation can\nonly be enabled on soft-delete enabled vaults.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param maxresults: Maximum number of results to return in a page. If not specified the service\n will return up to 25 results.\n:type maxresults: int\n:param include_pending: Specifies whether to include certificates which are not completely\n provisioned.\n:type include_pending: bool\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response)\n:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, maxresults, include_pending" + }, + "get_deleted_certificate" : { + "sync": { + "signature": "def get_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def get_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.DeletedCertificateBundle\":\n", + "doc": "\"\"\"Retrieves information about the specified deleted certificate.\n\nThe GetDeletedCertificate operation retrieves the deleted certificate information plus its\nattributes, such as retention interval, scheduled permanent deletion and the current deletion\nrecovery level. This operation requires the certificates/get permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: DeletedCertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "purge_deleted_certificate" : { + "sync": { + "signature": "def purge_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def purge_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e None:\n", + "doc": "\"\"\"Permanently deletes the specified deleted certificate.\n\nThe PurgeDeletedCertificate operation performs an irreversible deletion of the specified\ncertificate, without possibility for recovery. The operation is not available if the recovery\nlevel does not specify \u0027Purgeable\u0027. This operation requires the certificate/purge permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + }, + "recover_deleted_certificate" : { + "sync": { + "signature": "def recover_deleted_certificate(\n self,\n vault_base_url, # type: str\n certificate_name, # type: str\n **kwargs # type: Any\n):\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "async": { + "coroutine": true, + "signature": "async def recover_deleted_certificate(\n self,\n vault_base_url: str,\n certificate_name: str,\n **kwargs\n) -\u003e \"models.CertificateBundle\":\n", + "doc": "\"\"\"Recovers the deleted certificate back to its current version under /certificates.\n\nThe RecoverDeletedCertificate operation performs the reversal of the Delete operation. The\noperation is applicable in vaults enabled for soft-delete, and must be issued during the\nretention interval (available in the deleted certificate\u0027s attributes). This operation requires\nthe certificates/recover permission.\n\n:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.\n:type vault_base_url: str\n:param certificate_name: The name of the deleted certificate.\n:type certificate_name: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: CertificateBundle, or the result of cls(response)\n:rtype: ~azure.keyvault.v7_2.models.CertificateBundle\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" + }, + "call": "vault_base_url, certificate_name" + } + }, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"], \"azure.core.paging\": [\"ItemPaged\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Iterable\", \"List\", \"Optional\", \"TypeVar\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"], \"azure.core.async_paging\": [\"AsyncItemPaged\", \"AsyncList\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\", \"Callable\", \"Dict\", \"Generic\", \"List\", \"Optional\", \"TypeVar\"]}}}" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/version.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/__init__.py similarity index 75% rename from sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/version.py rename to sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/__init__.py index 3c10f7d869d..71ceadebe43 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_0/version.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/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 = "7.0" - +from ._key_vault_client_async import KeyVaultClient +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_configuration_async.py new file mode 100644 index 00000000000..87b77e808df --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_configuration_async.py @@ -0,0 +1,45 @@ +# 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 KeyVaultClientConfiguration(Configuration): + """Configuration for KeyVaultClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + """ + + def __init__( + self, + **kwargs: Any + ) -> None: + super(KeyVaultClientConfiguration, self).__init__(**kwargs) + + self.api_version = "7.2-preview" + kwargs.setdefault('sdk_moniker', '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') diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_key_vault_client_async.py new file mode 100644 index 00000000000..2d273c4e45f --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/_key_vault_client_async.py @@ -0,0 +1,46 @@ +# 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 import AsyncPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultClientConfiguration +from .operations_async import KeyVaultClientOperationsMixin +from .. import models + + +class KeyVaultClient(KeyVaultClientOperationsMixin): + """The key vault client performs cryptographic key operations and vault operations against the Key Vault service. + + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + **kwargs: Any + ) -> None: + base_url = '{vaultBaseUrl}' + self._config = KeyVaultClientConfiguration(**kwargs) + self._client = AsyncPipelineClient(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) + + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultClient": + 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-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/__init__.py new file mode 100644 index 00000000000..b887c97a420 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._key_vault_client_operations_async import KeyVaultClientOperationsMixin + +__all__ = [ + 'KeyVaultClientOperationsMixin', +] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/_key_vault_client_operations_async.py new file mode 100644 index 00000000000..db26a607697 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/aio/operations_async/_key_vault_client_operations_async.py @@ -0,0 +1,1855 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, List, 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 ... import models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeyVaultClientOperationsMixin: + + def get_certificates( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: + """List certificates in a specified key vault. + + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + if include_pending is not None: + query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', 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]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + async def delete_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": + """Deletes a certificate from a specified key vault. + + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + async def set_certificate_contacts( + self, + vault_base_url: str, + contact_list: Optional[List["models.Contact"]] = None, + **kwargs + ) -> "models.Contacts": + """Sets the certificate contacts for the specified key vault. + + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.set_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + async def get_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": + """Lists the certificate contacts for a specified key vault. + + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + async def delete_certificate_contacts( + self, + vault_base_url: str, + **kwargs + ) -> "models.Contacts": + """Deletes the certificate contacts for a specified key vault. + + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_issuers( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateIssuerListResult"]: + """List certificate issuers for a specified key vault. + + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificate_issuers.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', 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]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + async def set_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: str, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": + """Sets the specified certificate issuer. + + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.set_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def update_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + provider: Optional[str] = None, + credentials: Optional["models.IssuerCredentials"] = None, + organization_details: Optional["models.OrganizationDetails"] = None, + attributes: Optional["models.IssuerAttributes"] = None, + **kwargs + ) -> "models.IssuerBundle": + """Updates the specified certificate issuer. + + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def get_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": + """Lists the specified certificate issuer. + + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def delete_certificate_issuer( + self, + vault_base_url: str, + issuer_name: str, + **kwargs + ) -> "models.IssuerBundle": + """Deletes the specified certificate issuer. + + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + async def create_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateOperation": + """Creates a new certificate. + + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + 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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + async def import_certificate( + self, + vault_base_url: str, + certificate_name: str, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Imports a certificate into a specified key vault. + + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires + the certificates/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.import_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore + + def get_certificate_versions( + self, + vault_base_url: str, + certificate_name: str, + maxresults: Optional[int] = None, + **kwargs + ) -> AsyncIterable["models.CertificateListResult"]: + """List the versions of a certificate. + + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificate_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', 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]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + async def get_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificatePolicy": + """Lists the policy for a certificate. + + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in a given key vault. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificatePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate_policy( + self, + vault_base_url: str, + certificate_name: str, + certificate_policy: "models.CertificatePolicy", + **kwargs + ) -> "models.CertificatePolicy": + """Updates the policy for a certificate. + + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificatePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + async def update_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + certificate_policy: Optional["models.CertificatePolicy"] = None, + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Updates the specified attributes associated with the given certificate. + + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. + :type certificate_version: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def get_certificate( + self, + vault_base_url: str, + certificate_name: str, + certificate_version: str, + **kwargs + ) -> "models.CertificateBundle": + """Gets information about a certificate. + + Gets information about a specific certificate. This operation requires the certificates/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. + :type certificate_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + async def update_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + cancellation_requested: bool, + **kwargs + ) -> "models.CertificateOperation": + """Updates a certificate operation. + + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def get_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": + """Gets the creation operation of a certificate. + + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def delete_certificate_operation( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateOperation": + """Deletes the creation operation for a specific certificate. + + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + async def merge_certificate( + self, + vault_base_url: str, + certificate_name: str, + x509_certificates: List[bytearray], + certificate_attributes: Optional["models.CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ) -> "models.CertificateBundle": + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param x509_certificates: The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.merge_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + async def backup_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.BackupCertificateResult": + """Backs up the specified certificate. + + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.backup_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + async def restore_certificate( + self, + vault_base_url: str, + certificate_bundle_backup: bytes, + **kwargs + ) -> "models.CertificateBundle": + """Restores a backed up certificate to a vault. + + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. + :type certificate_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.restore_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore + + def get_deleted_certificates( + self, + vault_base_url: str, + maxresults: Optional[int] = None, + include_pending: Optional[bool] = None, + **kwargs + ) -> AsyncIterable["models.DeletedCertificateListResult"]: + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_deleted_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + if include_pending is not None: + query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', 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]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + async def get_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.DeletedCertificateBundle": + """Retrieves information about the specified deleted certificate. + + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def purge_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> None: + """Permanently deletes the specified deleted certificate. + + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.purge_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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] + + 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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + async def recover_deleted_certificate( + self, + vault_base_url: str, + certificate_name: str, + **kwargs + ) -> "models.CertificateBundle": + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.recover_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/__init__.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/__init__.py new file mode 100644 index 00000000000..cf378fc39e3 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/__init__.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Action + from ._models_py3 import AdministratorDetails + from ._models_py3 import Attributes + from ._models_py3 import BackupCertificateResult + from ._models_py3 import CertificateAttributes + from ._models_py3 import CertificateBundle + from ._models_py3 import CertificateCreateParameters + from ._models_py3 import CertificateImportParameters + from ._models_py3 import CertificateIssuerItem + from ._models_py3 import CertificateIssuerListResult + from ._models_py3 import CertificateIssuerSetParameters + from ._models_py3 import CertificateIssuerUpdateParameters + from ._models_py3 import CertificateItem + from ._models_py3 import CertificateListResult + from ._models_py3 import CertificateMergeParameters + from ._models_py3 import CertificateOperation + from ._models_py3 import CertificateOperationUpdateParameter + from ._models_py3 import CertificatePolicy + from ._models_py3 import CertificateRestoreParameters + from ._models_py3 import CertificateUpdateParameters + from ._models_py3 import Contact + from ._models_py3 import Contacts + from ._models_py3 import DeletedCertificateBundle + from ._models_py3 import DeletedCertificateItem + from ._models_py3 import DeletedCertificateListResult + from ._models_py3 import Error + from ._models_py3 import IssuerAttributes + from ._models_py3 import IssuerBundle + from ._models_py3 import IssuerCredentials + from ._models_py3 import IssuerParameters + from ._models_py3 import KeyProperties + from ._models_py3 import KeyVaultError + from ._models_py3 import LifetimeAction + from ._models_py3 import OrganizationDetails + from ._models_py3 import PendingCertificateSigningRequestResult + from ._models_py3 import SecretProperties + from ._models_py3 import SubjectAlternativeNames + from ._models_py3 import Trigger + from ._models_py3 import X509CertificateProperties +except (SyntaxError, ImportError): + from ._models import Action # type: ignore + from ._models import AdministratorDetails # type: ignore + from ._models import Attributes # type: ignore + from ._models import BackupCertificateResult # type: ignore + from ._models import CertificateAttributes # type: ignore + from ._models import CertificateBundle # type: ignore + from ._models import CertificateCreateParameters # type: ignore + from ._models import CertificateImportParameters # type: ignore + from ._models import CertificateIssuerItem # type: ignore + from ._models import CertificateIssuerListResult # type: ignore + from ._models import CertificateIssuerSetParameters # type: ignore + from ._models import CertificateIssuerUpdateParameters # type: ignore + from ._models import CertificateItem # type: ignore + from ._models import CertificateListResult # type: ignore + from ._models import CertificateMergeParameters # type: ignore + from ._models import CertificateOperation # type: ignore + from ._models import CertificateOperationUpdateParameter # type: ignore + from ._models import CertificatePolicy # type: ignore + from ._models import CertificateRestoreParameters # type: ignore + from ._models import CertificateUpdateParameters # type: ignore + from ._models import Contact # type: ignore + from ._models import Contacts # type: ignore + from ._models import DeletedCertificateBundle # type: ignore + from ._models import DeletedCertificateItem # type: ignore + from ._models import DeletedCertificateListResult # type: ignore + from ._models import Error # type: ignore + from ._models import IssuerAttributes # type: ignore + from ._models import IssuerBundle # type: ignore + from ._models import IssuerCredentials # type: ignore + from ._models import IssuerParameters # type: ignore + from ._models import KeyProperties # type: ignore + from ._models import KeyVaultError # type: ignore + from ._models import LifetimeAction # type: ignore + from ._models import OrganizationDetails # type: ignore + from ._models import PendingCertificateSigningRequestResult # type: ignore + from ._models import SecretProperties # type: ignore + from ._models import SubjectAlternativeNames # type: ignore + from ._models import Trigger # type: ignore + from ._models import X509CertificateProperties # type: ignore + +from ._key_vault_client_enums import ( + ActionType, + DeletionRecoveryLevel, + JsonWebKeyCurveName, + JsonWebKeyType, + KeyUsageType, +) + +__all__ = [ + 'Action', + 'AdministratorDetails', + 'Attributes', + 'BackupCertificateResult', + 'CertificateAttributes', + 'CertificateBundle', + 'CertificateCreateParameters', + 'CertificateImportParameters', + 'CertificateIssuerItem', + 'CertificateIssuerListResult', + 'CertificateIssuerSetParameters', + 'CertificateIssuerUpdateParameters', + 'CertificateItem', + 'CertificateListResult', + 'CertificateMergeParameters', + 'CertificateOperation', + 'CertificateOperationUpdateParameter', + 'CertificatePolicy', + 'CertificateRestoreParameters', + 'CertificateUpdateParameters', + 'Contact', + 'Contacts', + 'DeletedCertificateBundle', + 'DeletedCertificateItem', + 'DeletedCertificateListResult', + 'Error', + 'IssuerAttributes', + 'IssuerBundle', + 'IssuerCredentials', + 'IssuerParameters', + 'KeyProperties', + 'KeyVaultError', + 'LifetimeAction', + 'OrganizationDetails', + 'PendingCertificateSigningRequestResult', + 'SecretProperties', + 'SubjectAlternativeNames', + 'Trigger', + 'X509CertificateProperties', + 'ActionType', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', + 'JsonWebKeyType', + 'KeyUsageType', +] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_key_vault_client_enums.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_key_vault_client_enums.py new file mode 100644 index 00000000000..5f151ec4b58 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_key_vault_client_enums.py @@ -0,0 +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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum + +class ActionType(str, Enum): + """The type of the action. + """ + + email_contacts = "EmailContacts" + auto_renew = "AutoRenew" + +class DeletionRecoveryLevel(str, Enum): + """Reflects the deletion recovery level currently in effect for certificates in the current vault. + If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; + otherwise, only the system can purge the certificate, at the end of the retention interval. + """ + + purgeable = "Purgeable" + recoverable_purgeable = "Recoverable+Purgeable" + recoverable = "Recoverable" + recoverable_protected_subscription = "Recoverable+ProtectedSubscription" + customized_recoverable_purgeable = "CustomizedRecoverable+Purgeable" + customized_recoverable = "CustomizedRecoverable" + customized_recoverable_protected_subscription = "CustomizedRecoverable+ProtectedSubscription" + +class JsonWebKeyCurveName(str, Enum): + """Elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + p256 = "P-256" + p384 = "P-384" + p521 = "P-521" + p256_k = "P-256K" + +class JsonWebKeyType(str, Enum): + """The type of key pair to be used for the certificate. + """ + + ec = "EC" + ec_hsm = "EC-HSM" + rsa = "RSA" + rsa_hsm = "RSA-HSM" + oct = "oct" + oct_hsm = "oct-HSM" + +class KeyUsageType(str, Enum): + + digital_signature = "digitalSignature" + non_repudiation = "nonRepudiation" + key_encipherment = "keyEncipherment" + data_encipherment = "dataEncipherment" + key_agreement = "keyAgreement" + key_cert_sign = "keyCertSign" + c_rl_sign = "cRLSign" + encipher_only = "encipherOnly" + decipher_only = "decipherOnly" diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models.py new file mode 100644 index 00000000000..67182315a0e --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models.py @@ -0,0 +1,1329 @@ +# 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.core.exceptions import HttpResponseError +import msrest.serialization + + +class Action(msrest.serialization.Model): + """The action that will be executed. + + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". + :type action_type: str or ~azure.keyvault.v7_2.models.ActionType + """ + + _attribute_map = { + 'action_type': {'key': 'action_type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.action_type = kwargs.get('action_type', None) + + +class AdministratorDetails(msrest.serialization.Model): + """Details of the organization administrator of the certificate issuer. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + :param phone: Phone number. + :type phone: str + """ + + _attribute_map = { + 'first_name': {'key': 'first_name', 'type': 'str'}, + 'last_name': {'key': 'last_name', 'type': 'str'}, + 'email_address': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AdministratorDetails, self).__init__(**kwargs) + self.first_name = kwargs.get('first_name', None) + self.last_name = kwargs.get('last_name', None) + self.email_address = kwargs.get('email_address', None) + self.phone = kwargs.get('phone', None) + + +class Attributes(msrest.serialization.Model): + """The object attributes managed by the KeyVault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in UTC. + :type not_before: ~datetime.datetime + :param expires: Expiry date in UTC. + :type expires: ~datetime.datetime + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.not_before = kwargs.get('not_before', None) + self.expires = kwargs.get('expires', None) + self.created = None + self.updated = None + + +class BackupCertificateResult(msrest.serialization.Model): + """The backup certificate result, containing the backup blob. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The backup blob containing the backed up certificate. + :vartype value: bytes + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'base64'}, + } + + def __init__( + self, + **kwargs + ): + super(BackupCertificateResult, self).__init__(**kwargs) + self.value = None + + +class CertificateAttributes(Attributes): + """The certificate management attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in UTC. + :type not_before: ~datetime.datetime + :param expires: Expiry date in UTC. + :type expires: ~datetime.datetime + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + :ivar recoverable_days: softDelete data retention days. Value should be >=7 and <=90 when + softDelete enabled, otherwise 0. + :vartype recoverable_days: int + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_2.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recoverable_days': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateAttributes, self).__init__(**kwargs) + self.recoverable_days = None + self.recovery_level = None + + +class CertificateBundle(msrest.serialization.Model): + """A certificate bundle consists of a certificate (X509) plus its attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :ivar kid: The key id. + :vartype kid: str + :ivar sid: The secret id. + :vartype sid: str + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype x509_thumbprint: bytes + :ivar policy: The management policy. + :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param cer: CER contents of x509 certificate. + :type cer: bytearray + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'kid': {'readonly': True}, + 'sid': {'readonly': True}, + 'x509_thumbprint': {'readonly': True}, + 'policy': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'sid': {'key': 'sid', 'type': 'str'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'cer': {'key': 'cer', 'type': 'bytearray'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateBundle, self).__init__(**kwargs) + self.id = None + self.kid = None + self.sid = None + self.x509_thumbprint = None + self.policy = None + self.cer = kwargs.get('cer', None) + self.content_type = kwargs.get('content_type', None) + self.attributes = kwargs.get('attributes', None) + self.tags = kwargs.get('tags', None) + + +class CertificateCreateParameters(msrest.serialization.Model): + """The certificate create parameters. + + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateCreateParameters, self).__init__(**kwargs) + self.certificate_policy = kwargs.get('certificate_policy', None) + self.certificate_attributes = kwargs.get('certificate_attributes', None) + self.tags = kwargs.get('tags', None) + + +class CertificateImportParameters(msrest.serialization.Model): + """The certificate import parameters. + + All required parameters must be populated in order to send to Azure. + + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'base64_encoded_certificate': {'required': True}, + } + + _attribute_map = { + 'base64_encoded_certificate': {'key': 'value', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateImportParameters, self).__init__(**kwargs) + self.base64_encoded_certificate = kwargs['base64_encoded_certificate'] + self.password = kwargs.get('password', None) + self.certificate_policy = kwargs.get('certificate_policy', None) + self.certificate_attributes = kwargs.get('certificate_attributes', None) + self.tags = kwargs.get('tags', None) + + +class CertificateIssuerItem(msrest.serialization.Model): + """The certificate issuer item containing certificate issuer metadata. + + :param id: Certificate Identifier. + :type id: str + :param provider: The issuer provider. + :type provider: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateIssuerItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.provider = kwargs.get('provider', None) + + +class CertificateIssuerListResult(msrest.serialization.Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. + :vartype value: list[~azure.keyvault.v7_2.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CertificateIssuerSetParameters(msrest.serialization.Model): + """The certificate issuer set parameters. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _validation = { + 'provider': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateIssuerSetParameters, self).__init__(**kwargs) + self.provider = kwargs['provider'] + self.credentials = kwargs.get('credentials', None) + self.organization_details = kwargs.get('organization_details', None) + self.attributes = kwargs.get('attributes', None) + + +class CertificateIssuerUpdateParameters(msrest.serialization.Model): + """The certificate issuer update parameters. + + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.credentials = kwargs.get('credentials', None) + self.organization_details = kwargs.get('organization_details', None) + self.attributes = kwargs.get('attributes', None) + + +class CertificateItem(msrest.serialization.Model): + """The certificate item containing certificate metadata. + + :param id: Certificate identifier. + :type id: str + :param attributes: The certificate management attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param x509_thumbprint: Thumbprint of the certificate. + :type x509_thumbprint: bytes + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.attributes = kwargs.get('attributes', None) + self.tags = kwargs.get('tags', None) + self.x509_thumbprint = kwargs.get('x509_thumbprint', None) + + +class CertificateListResult(msrest.serialization.Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_2.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CertificateMergeParameters(msrest.serialization.Model): + """The certificate merge parameters. + + All required parameters must be populated in order to send to Azure. + + :param x509_certificates: Required. The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'x509_certificates': {'required': True}, + } + + _attribute_map = { + 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateMergeParameters, self).__init__(**kwargs) + self.x509_certificates = kwargs['x509_certificates'] + self.certificate_attributes = kwargs.get('certificate_attributes', None) + self.tags = kwargs.get('tags', None) + + +class CertificateOperation(msrest.serialization.Model): + """A certificate operation is returned in case of asynchronous requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. + :type csr: bytearray + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :param status: Status of the certificate operation. + :type status: str + :param status_details: The status details of the certificate operation. + :type status_details: str + :param error: Error encountered, if any, during the certificate operation. + :type error: ~azure.keyvault.v7_2.models.Error + :param target: Location which contains the result of the certificate operation. + :type target: str + :param request_id: Identifier for the certificate operation. + :type request_id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'issuer_parameters': {'key': 'issuer', 'type': 'IssuerParameters'}, + 'csr': {'key': 'csr', 'type': 'bytearray'}, + 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'str'}, + 'status_details': {'key': 'status_details', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'target': {'key': 'target', 'type': 'str'}, + 'request_id': {'key': 'request_id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateOperation, self).__init__(**kwargs) + self.id = None + self.issuer_parameters = kwargs.get('issuer_parameters', None) + self.csr = kwargs.get('csr', None) + self.cancellation_requested = kwargs.get('cancellation_requested', None) + self.status = kwargs.get('status', None) + self.status_details = kwargs.get('status_details', None) + self.error = kwargs.get('error', None) + self.target = kwargs.get('target', None) + self.request_id = kwargs.get('request_id', None) + + +class CertificateOperationUpdateParameter(msrest.serialization.Model): + """The certificate operation update parameters. + + All required parameters must be populated in order to send to Azure. + + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. + :type cancellation_requested: bool + """ + + _validation = { + 'cancellation_requested': {'required': True}, + } + + _attribute_map = { + 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + self.cancellation_requested = kwargs['cancellation_requested'] + + +class CertificatePolicy(msrest.serialization.Model): + """Management policy for a certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :param key_properties: Properties of the key backing a certificate. + :type key_properties: ~azure.keyvault.v7_2.models.KeyProperties + :param secret_properties: Properties of the secret backing a certificate. + :type secret_properties: ~azure.keyvault.v7_2.models.SecretProperties + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_2.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a + certificate. + :type lifetime_actions: list[~azure.keyvault.v7_2.models.LifetimeAction] + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_properties': {'key': 'key_props', 'type': 'KeyProperties'}, + 'secret_properties': {'key': 'secret_props', 'type': 'SecretProperties'}, + 'x509_certificate_properties': {'key': 'x509_props', 'type': 'X509CertificateProperties'}, + 'lifetime_actions': {'key': 'lifetime_actions', 'type': '[LifetimeAction]'}, + 'issuer_parameters': {'key': 'issuer', 'type': 'IssuerParameters'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificatePolicy, self).__init__(**kwargs) + self.id = None + self.key_properties = kwargs.get('key_properties', None) + self.secret_properties = kwargs.get('secret_properties', None) + self.x509_certificate_properties = kwargs.get('x509_certificate_properties', None) + self.lifetime_actions = kwargs.get('lifetime_actions', None) + self.issuer_parameters = kwargs.get('issuer_parameters', None) + self.attributes = kwargs.get('attributes', None) + + +class CertificateRestoreParameters(msrest.serialization.Model): + """The certificate restore parameters. + + All required parameters must be populated in order to send to Azure. + + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. + :type certificate_bundle_backup: bytes + """ + + _validation = { + 'certificate_bundle_backup': {'required': True}, + } + + _attribute_map = { + 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateRestoreParameters, self).__init__(**kwargs) + self.certificate_bundle_backup = kwargs['certificate_bundle_backup'] + + +class CertificateUpdateParameters(msrest.serialization.Model): + """The certificate update parameters. + + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateUpdateParameters, self).__init__(**kwargs) + self.certificate_policy = kwargs.get('certificate_policy', None) + self.certificate_attributes = kwargs.get('certificate_attributes', None) + self.tags = kwargs.get('tags', None) + + +class Contact(msrest.serialization.Model): + """The contact information for the vault certificates. + + :param email_address: Email address. + :type email_address: str + :param name: Name. + :type name: str + :param phone: Phone number. + :type phone: str + """ + + _attribute_map = { + 'email_address': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Contact, self).__init__(**kwargs) + self.email_address = kwargs.get('email_address', None) + self.name = kwargs.get('name', None) + self.phone = kwargs.get('phone', None) + + +class Contacts(msrest.serialization.Model): + """The contacts for the vault certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Identifier for the contacts collection. + :vartype id: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + } + + def __init__( + self, + **kwargs + ): + super(Contacts, self).__init__(**kwargs) + self.id = None + self.contact_list = kwargs.get('contact_list', None) + + +class DeletedCertificateBundle(CertificateBundle): + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :ivar kid: The key id. + :vartype kid: str + :ivar sid: The secret id. + :vartype sid: str + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype x509_thumbprint: bytes + :ivar policy: The management policy. + :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param cer: CER contents of x509 certificate. + :type cer: bytearray + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :type recovery_id: str + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'kid': {'readonly': True}, + 'sid': {'readonly': True}, + 'x509_thumbprint': {'readonly': True}, + 'policy': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'deleted_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'sid': {'key': 'sid', 'type': 'str'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'cer': {'key': 'cer', 'type': 'bytearray'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, + 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedCertificateBundle, self).__init__(**kwargs) + self.recovery_id = kwargs.get('recovery_id', None) + self.scheduled_purge_date = None + self.deleted_date = None + + +class DeletedCertificateItem(CertificateItem): + """The deleted certificate item containing metadata about the deleted certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Certificate identifier. + :type id: str + :param attributes: The certificate management attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param x509_thumbprint: Thumbprint of the certificate. + :type x509_thumbprint: bytes + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :type recovery_id: str + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime + """ + + _validation = { + 'scheduled_purge_date': {'readonly': True}, + 'deleted_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, + 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedCertificateItem, self).__init__(**kwargs) + self.recovery_id = kwargs.get('recovery_id', None) + self.scheduled_purge_date = None + self.deleted_date = None + + +class DeletedCertificateListResult(msrest.serialization.Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. + :vartype value: list[~azure.keyvault.v7_2.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Error(msrest.serialization.Model): + """The key vault server error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The key vault server error. + :vartype inner_error: ~azure.keyvault.v7_2.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IssuerAttributes(msrest.serialization.Model): + """The attributes of an issuer managed by the Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the issuer is enabled. + :type enabled: bool + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(IssuerAttributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.created = None + self.updated = None + + +class IssuerBundle(msrest.serialization.Model): + """The issuer for Key Vault certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Identifier for the issuer object. + :vartype id: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + **kwargs + ): + super(IssuerBundle, self).__init__(**kwargs) + self.id = None + self.provider = kwargs.get('provider', None) + self.credentials = kwargs.get('credentials', None) + self.organization_details = kwargs.get('organization_details', None) + self.attributes = kwargs.get('attributes', None) + + +class IssuerCredentials(msrest.serialization.Model): + """The credentials to be used for the certificate issuer. + + :param account_id: The user name/account name/account id. + :type account_id: str + :param password: The password/secret/account key. + :type password: str + """ + + _attribute_map = { + 'account_id': {'key': 'account_id', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IssuerCredentials, self).__init__(**kwargs) + self.account_id = kwargs.get('account_id', None) + self.password = kwargs.get('password', None) + + +class IssuerParameters(msrest.serialization.Model): + """Parameters for the issuer of the X509 component of a certificate. + + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. + :type name: str + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. + :type certificate_type: str + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. + :type certificate_transparency: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'certificate_type': {'key': 'cty', 'type': 'str'}, + 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(IssuerParameters, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.certificate_type = kwargs.get('certificate_type', None) + self.certificate_transparency = kwargs.get('certificate_transparency', None) + + +class KeyProperties(msrest.serialization.Model): + """Properties of the key pair backing a certificate. + + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :type key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. + :type reuse_key: bool + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". + :type curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName + """ + + _attribute_map = { + 'exportable': {'key': 'exportable', 'type': 'bool'}, + 'key_type': {'key': 'kty', 'type': 'str'}, + 'key_size': {'key': 'key_size', 'type': 'int'}, + 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, + 'curve': {'key': 'crv', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.exportable = kwargs.get('exportable', None) + self.key_type = kwargs.get('key_type', None) + self.key_size = kwargs.get('key_size', None) + self.reuse_key = kwargs.get('reuse_key', None) + self.curve = kwargs.get('curve', None) + + +class KeyVaultError(msrest.serialization.Model): + """The key vault error exception. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The key vault server error. + :vartype error: ~azure.keyvault.v7_2.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultError, self).__init__(**kwargs) + self.error = None + + +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. + + :param trigger: The condition that will execute the action. + :type trigger: ~azure.keyvault.v7_2.models.Trigger + :param action: The action that will be executed. + :type action: ~azure.keyvault.v7_2.models.Action + """ + + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, + } + + def __init__( + self, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = kwargs.get('trigger', None) + self.action = kwargs.get('action', None) + + +class OrganizationDetails(msrest.serialization.Model): + """Details of the organization of the certificate issuer. + + :param id: Id of the organization. + :type id: str + :param admin_details: Details of the organization administrator. + :type admin_details: list[~azure.keyvault.v7_2.models.AdministratorDetails] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + } + + def __init__( + self, + **kwargs + ): + super(OrganizationDetails, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.admin_details = kwargs.get('admin_details', None) + + +class PendingCertificateSigningRequestResult(msrest.serialization.Model): + """The pending certificate signing request result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The pending certificate signing request as Base64 encoded string. + :vartype value: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + self.value = None + + +class SecretProperties(msrest.serialization.Model): + """Properties of the key backing a certificate. + + :param content_type: The media type (MIME type). + :type content_type: str + """ + + _attribute_map = { + 'content_type': {'key': 'contentType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretProperties, self).__init__(**kwargs) + self.content_type = kwargs.get('content_type', None) + + +class SubjectAlternativeNames(msrest.serialization.Model): + """The subject alternate names of a X509 object. + + :param emails: Email addresses. + :type emails: list[str] + :param dns_names: Domain names. + :type dns_names: list[str] + :param upns: User principal names. + :type upns: list[str] + """ + + _attribute_map = { + 'emails': {'key': 'emails', 'type': '[str]'}, + 'dns_names': {'key': 'dns_names', 'type': '[str]'}, + 'upns': {'key': 'upns', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SubjectAlternativeNames, self).__init__(**kwargs) + self.emails = kwargs.get('emails', None) + self.dns_names = kwargs.get('dns_names', None) + self.upns = kwargs.get('upns', None) + + +class Trigger(msrest.serialization.Model): + """A condition to be satisfied for an action to be executed. + + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. + :type lifetime_percentage: int + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). + :type days_before_expiry: int + """ + + _validation = { + 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + } + + _attribute_map = { + 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, + 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Trigger, self).__init__(**kwargs) + self.lifetime_percentage = kwargs.get('lifetime_percentage', None) + self.days_before_expiry = kwargs.get('days_before_expiry', None) + + +class X509CertificateProperties(msrest.serialization.Model): + """Properties of the X509 component of a certificate. + + :param subject: The subject name. Should be a valid X509 distinguished Name. + :type subject: str + :param ekus: The enhanced key usage. + :type ekus: list[str] + :param subject_alternative_names: The subject alternative names. + :type subject_alternative_names: ~azure.keyvault.v7_2.models.SubjectAlternativeNames + :param key_usage: List of key usages. + :type key_usage: list[str or ~azure.keyvault.v7_2.models.KeyUsageType] + :param validity_in_months: The duration that the certificate is valid in months. + :type validity_in_months: int + """ + + _validation = { + 'validity_in_months': {'minimum': 0}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'ekus': {'key': 'ekus', 'type': '[str]'}, + 'subject_alternative_names': {'key': 'sans', 'type': 'SubjectAlternativeNames'}, + 'key_usage': {'key': 'key_usage', 'type': '[str]'}, + 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(X509CertificateProperties, self).__init__(**kwargs) + self.subject = kwargs.get('subject', None) + self.ekus = kwargs.get('ekus', None) + self.subject_alternative_names = kwargs.get('subject_alternative_names', None) + self.key_usage = kwargs.get('key_usage', None) + self.validity_in_months = kwargs.get('validity_in_months', None) diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models_py3.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models_py3.py new file mode 100644 index 00000000000..01cfaf8e896 --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/models/_models_py3.py @@ -0,0 +1,1469 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._key_vault_client_enums import * + + +class Action(msrest.serialization.Model): + """The action that will be executed. + + :param action_type: The type of the action. Possible values include: "EmailContacts", + "AutoRenew". + :type action_type: str or ~azure.keyvault.v7_2.models.ActionType + """ + + _attribute_map = { + 'action_type': {'key': 'action_type', 'type': 'str'}, + } + + def __init__( + self, + *, + action_type: Optional[Union[str, "ActionType"]] = None, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.action_type = action_type + + +class AdministratorDetails(msrest.serialization.Model): + """Details of the organization administrator of the certificate issuer. + + :param first_name: First name. + :type first_name: str + :param last_name: Last name. + :type last_name: str + :param email_address: Email address. + :type email_address: str + :param phone: Phone number. + :type phone: str + """ + + _attribute_map = { + 'first_name': {'key': 'first_name', 'type': 'str'}, + 'last_name': {'key': 'last_name', 'type': 'str'}, + 'email_address': {'key': 'email', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + email_address: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): + super(AdministratorDetails, self).__init__(**kwargs) + self.first_name = first_name + self.last_name = last_name + self.email_address = email_address + self.phone = phone + + +class Attributes(msrest.serialization.Model): + """The object attributes managed by the KeyVault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in UTC. + :type not_before: ~datetime.datetime + :param expires: Expiry date in UTC. + :type expires: ~datetime.datetime + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + + +class BackupCertificateResult(msrest.serialization.Model): + """The backup certificate result, containing the backup blob. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The backup blob containing the backed up certificate. + :vartype value: bytes + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'base64'}, + } + + def __init__( + self, + **kwargs + ): + super(BackupCertificateResult, self).__init__(**kwargs) + self.value = None + + +class CertificateAttributes(Attributes): + """The certificate management attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in UTC. + :type not_before: ~datetime.datetime + :param expires: Expiry date in UTC. + :type expires: ~datetime.datetime + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + :ivar recoverable_days: softDelete data retention days. Value should be >=7 and <=90 when + softDelete enabled, otherwise 0. + :vartype recoverable_days: int + :ivar recovery_level: Reflects the deletion recovery level currently in effect for certificates + in the current vault. If it contains 'Purgeable', the certificate can be permanently deleted by + a privileged user; otherwise, only the system can purge the certificate, at the end of the + retention interval. Possible values include: "Purgeable", "Recoverable+Purgeable", + "Recoverable", "Recoverable+ProtectedSubscription", "CustomizedRecoverable+Purgeable", + "CustomizedRecoverable", "CustomizedRecoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.keyvault.v7_2.models.DeletionRecoveryLevel + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recoverable_days': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + 'recoverable_days': {'key': 'recoverableDays', 'type': 'int'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + super(CertificateAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + self.recoverable_days = None + self.recovery_level = None + + +class CertificateBundle(msrest.serialization.Model): + """A certificate bundle consists of a certificate (X509) plus its attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :ivar kid: The key id. + :vartype kid: str + :ivar sid: The secret id. + :vartype sid: str + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype x509_thumbprint: bytes + :ivar policy: The management policy. + :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param cer: CER contents of x509 certificate. + :type cer: bytearray + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'kid': {'readonly': True}, + 'sid': {'readonly': True}, + 'x509_thumbprint': {'readonly': True}, + 'policy': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'sid': {'key': 'sid', 'type': 'str'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'cer': {'key': 'cer', 'type': 'bytearray'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CertificateBundle, self).__init__(**kwargs) + self.id = None + self.kid = None + self.sid = None + self.x509_thumbprint = None + self.policy = None + self.cer = cer + self.content_type = content_type + self.attributes = attributes + self.tags = tags + + +class CertificateCreateParameters(msrest.serialization.Model): + """The certificate create parameters. + + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CertificateCreateParameters, self).__init__(**kwargs) + self.certificate_policy = certificate_policy + self.certificate_attributes = certificate_attributes + self.tags = tags + + +class CertificateImportParameters(msrest.serialization.Model): + """The certificate import parameters. + + All required parameters must be populated in order to send to Azure. + + :param base64_encoded_certificate: Required. Base64 encoded representation of the certificate + object to import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'base64_encoded_certificate': {'required': True}, + } + + _attribute_map = { + 'base64_encoded_certificate': {'key': 'value', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + base64_encoded_certificate: str, + password: Optional[str] = None, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CertificateImportParameters, self).__init__(**kwargs) + self.base64_encoded_certificate = base64_encoded_certificate + self.password = password + self.certificate_policy = certificate_policy + self.certificate_attributes = certificate_attributes + self.tags = tags + + +class CertificateIssuerItem(msrest.serialization.Model): + """The certificate issuer item containing certificate issuer metadata. + + :param id: Certificate Identifier. + :type id: str + :param provider: The issuer provider. + :type provider: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + provider: Optional[str] = None, + **kwargs + ): + super(CertificateIssuerItem, self).__init__(**kwargs) + self.id = id + self.provider = provider + + +class CertificateIssuerListResult(msrest.serialization.Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of certificate issuers in the key vault along + with a link to the next page of certificate issuers. + :vartype value: list[~azure.keyvault.v7_2.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CertificateIssuerSetParameters(msrest.serialization.Model): + """The certificate issuer set parameters. + + All required parameters must be populated in order to send to Azure. + + :param provider: Required. The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _validation = { + 'provider': {'required': True}, + } + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + *, + provider: str, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): + super(CertificateIssuerSetParameters, self).__init__(**kwargs) + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes + + +class CertificateIssuerUpdateParameters(msrest.serialization.Model): + """The certificate issuer update parameters. + + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): + super(CertificateIssuerUpdateParameters, self).__init__(**kwargs) + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes + + +class CertificateItem(msrest.serialization.Model): + """The certificate item containing certificate metadata. + + :param id: Certificate identifier. + :type id: str + :param attributes: The certificate management attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param x509_thumbprint: Thumbprint of the certificate. + :type x509_thumbprint: bytes + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + **kwargs + ): + super(CertificateItem, self).__init__(**kwargs) + self.id = id + self.attributes = attributes + self.tags = tags + self.x509_thumbprint = x509_thumbprint + + +class CertificateListResult(msrest.serialization.Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of certificates in the key vault along with a + link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_2.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class CertificateMergeParameters(msrest.serialization.Model): + """The certificate merge parameters. + + All required parameters must be populated in order to send to Azure. + + :param x509_certificates: Required. The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _validation = { + 'x509_certificates': {'required': True}, + } + + _attribute_map = { + 'x509_certificates': {'key': 'x5c', 'type': '[bytearray]'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + x509_certificates: List[bytearray], + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CertificateMergeParameters, self).__init__(**kwargs) + self.x509_certificates = x509_certificates + self.certificate_attributes = certificate_attributes + self.tags = tags + + +class CertificateOperation(msrest.serialization.Model): + """A certificate operation is returned in case of asynchronous requests. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters + :param csr: The certificate signing request (CSR) that is being used in the certificate + operation. + :type csr: bytearray + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :param status: Status of the certificate operation. + :type status: str + :param status_details: The status details of the certificate operation. + :type status_details: str + :param error: Error encountered, if any, during the certificate operation. + :type error: ~azure.keyvault.v7_2.models.Error + :param target: Location which contains the result of the certificate operation. + :type target: str + :param request_id: Identifier for the certificate operation. + :type request_id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'issuer_parameters': {'key': 'issuer', 'type': 'IssuerParameters'}, + 'csr': {'key': 'csr', 'type': 'bytearray'}, + 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + 'status': {'key': 'status', 'type': 'str'}, + 'status_details': {'key': 'status_details', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'Error'}, + 'target': {'key': 'target', 'type': 'str'}, + 'request_id': {'key': 'request_id', 'type': 'str'}, + } + + def __init__( + self, + *, + issuer_parameters: Optional["IssuerParameters"] = None, + csr: Optional[bytearray] = None, + cancellation_requested: Optional[bool] = None, + status: Optional[str] = None, + status_details: Optional[str] = None, + error: Optional["Error"] = None, + target: Optional[str] = None, + request_id: Optional[str] = None, + **kwargs + ): + super(CertificateOperation, self).__init__(**kwargs) + self.id = None + self.issuer_parameters = issuer_parameters + self.csr = csr + self.cancellation_requested = cancellation_requested + self.status = status + self.status_details = status_details + self.error = error + self.target = target + self.request_id = request_id + + +class CertificateOperationUpdateParameter(msrest.serialization.Model): + """The certificate operation update parameters. + + All required parameters must be populated in order to send to Azure. + + :param cancellation_requested: Required. Indicates if cancellation was requested on the + certificate operation. + :type cancellation_requested: bool + """ + + _validation = { + 'cancellation_requested': {'required': True}, + } + + _attribute_map = { + 'cancellation_requested': {'key': 'cancellation_requested', 'type': 'bool'}, + } + + def __init__( + self, + *, + cancellation_requested: bool, + **kwargs + ): + super(CertificateOperationUpdateParameter, self).__init__(**kwargs) + self.cancellation_requested = cancellation_requested + + +class CertificatePolicy(msrest.serialization.Model): + """Management policy for a certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :param key_properties: Properties of the key backing a certificate. + :type key_properties: ~azure.keyvault.v7_2.models.KeyProperties + :param secret_properties: Properties of the secret backing a certificate. + :type secret_properties: ~azure.keyvault.v7_2.models.SecretProperties + :param x509_certificate_properties: Properties of the X509 component of a certificate. + :type x509_certificate_properties: ~azure.keyvault.v7_2.models.X509CertificateProperties + :param lifetime_actions: Actions that will be performed by Key Vault over the lifetime of a + certificate. + :type lifetime_actions: list[~azure.keyvault.v7_2.models.LifetimeAction] + :param issuer_parameters: Parameters for the issuer of the X509 component of a certificate. + :type issuer_parameters: ~azure.keyvault.v7_2.models.IssuerParameters + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'key_properties': {'key': 'key_props', 'type': 'KeyProperties'}, + 'secret_properties': {'key': 'secret_props', 'type': 'SecretProperties'}, + 'x509_certificate_properties': {'key': 'x509_props', 'type': 'X509CertificateProperties'}, + 'lifetime_actions': {'key': 'lifetime_actions', 'type': '[LifetimeAction]'}, + 'issuer_parameters': {'key': 'issuer', 'type': 'IssuerParameters'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + } + + def __init__( + self, + *, + key_properties: Optional["KeyProperties"] = None, + secret_properties: Optional["SecretProperties"] = None, + x509_certificate_properties: Optional["X509CertificateProperties"] = None, + lifetime_actions: Optional[List["LifetimeAction"]] = None, + issuer_parameters: Optional["IssuerParameters"] = None, + attributes: Optional["CertificateAttributes"] = None, + **kwargs + ): + super(CertificatePolicy, self).__init__(**kwargs) + self.id = None + self.key_properties = key_properties + self.secret_properties = secret_properties + self.x509_certificate_properties = x509_certificate_properties + self.lifetime_actions = lifetime_actions + self.issuer_parameters = issuer_parameters + self.attributes = attributes + + +class CertificateRestoreParameters(msrest.serialization.Model): + """The certificate restore parameters. + + All required parameters must be populated in order to send to Azure. + + :param certificate_bundle_backup: Required. The backup blob associated with a certificate + bundle. + :type certificate_bundle_backup: bytes + """ + + _validation = { + 'certificate_bundle_backup': {'required': True}, + } + + _attribute_map = { + 'certificate_bundle_backup': {'key': 'value', 'type': 'base64'}, + } + + def __init__( + self, + *, + certificate_bundle_backup: bytes, + **kwargs + ): + super(CertificateRestoreParameters, self).__init__(**kwargs) + self.certificate_bundle_backup = certificate_bundle_backup + + +class CertificateUpdateParameters(msrest.serialization.Model): + """The certificate update parameters. + + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + certificate_policy: Optional["CertificatePolicy"] = None, + certificate_attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(CertificateUpdateParameters, self).__init__(**kwargs) + self.certificate_policy = certificate_policy + self.certificate_attributes = certificate_attributes + self.tags = tags + + +class Contact(msrest.serialization.Model): + """The contact information for the vault certificates. + + :param email_address: Email address. + :type email_address: str + :param name: Name. + :type name: str + :param phone: Phone number. + :type phone: str + """ + + _attribute_map = { + 'email_address': {'key': 'email', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'phone': {'key': 'phone', 'type': 'str'}, + } + + def __init__( + self, + *, + email_address: Optional[str] = None, + name: Optional[str] = None, + phone: Optional[str] = None, + **kwargs + ): + super(Contact, self).__init__(**kwargs) + self.email_address = email_address + self.name = name + self.phone = phone + + +class Contacts(msrest.serialization.Model): + """The contacts for the vault certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Identifier for the contacts collection. + :vartype id: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'contact_list': {'key': 'contacts', 'type': '[Contact]'}, + } + + def __init__( + self, + *, + contact_list: Optional[List["Contact"]] = None, + **kwargs + ): + super(Contacts, self).__init__(**kwargs) + self.id = None + self.contact_list = contact_list + + +class DeletedCertificateBundle(CertificateBundle): + """A Deleted Certificate consisting of its previous id, attributes and its tags, as well as information on when it will be purged. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The certificate id. + :vartype id: str + :ivar kid: The key id. + :vartype kid: str + :ivar sid: The secret id. + :vartype sid: str + :ivar x509_thumbprint: Thumbprint of the certificate. + :vartype x509_thumbprint: bytes + :ivar policy: The management policy. + :vartype policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param cer: CER contents of x509 certificate. + :type cer: bytearray + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The certificate attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :type recovery_id: str + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'kid': {'readonly': True}, + 'sid': {'readonly': True}, + 'x509_thumbprint': {'readonly': True}, + 'policy': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'deleted_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'kid': {'key': 'kid', 'type': 'str'}, + 'sid': {'key': 'sid', 'type': 'str'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'policy': {'key': 'policy', 'type': 'CertificatePolicy'}, + 'cer': {'key': 'cer', 'type': 'bytearray'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, + 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + cer: Optional[bytearray] = None, + content_type: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + recovery_id: Optional[str] = None, + **kwargs + ): + super(DeletedCertificateBundle, self).__init__(cer=cer, content_type=content_type, attributes=attributes, tags=tags, **kwargs) + self.recovery_id = recovery_id + self.scheduled_purge_date = None + self.deleted_date = None + + +class DeletedCertificateItem(CertificateItem): + """The deleted certificate item containing metadata about the deleted certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param id: Certificate identifier. + :type id: str + :param attributes: The certificate management attributes. + :type attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: A set of tags. Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :param x509_thumbprint: Thumbprint of the certificate. + :type x509_thumbprint: bytes + :param recovery_id: The url of the recovery object, used to identify and recover the deleted + certificate. + :type recovery_id: str + :ivar scheduled_purge_date: The time when the certificate is scheduled to be purged, in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar deleted_date: The time when the certificate was deleted, in UTC. + :vartype deleted_date: ~datetime.datetime + """ + + _validation = { + 'scheduled_purge_date': {'readonly': True}, + 'deleted_date': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'x509_thumbprint': {'key': 'x5t', 'type': 'base64'}, + 'recovery_id': {'key': 'recoveryId', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'unix-time'}, + 'deleted_date': {'key': 'deletedDate', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + attributes: Optional["CertificateAttributes"] = None, + tags: Optional[Dict[str, str]] = None, + x509_thumbprint: Optional[bytes] = None, + recovery_id: Optional[str] = None, + **kwargs + ): + super(DeletedCertificateItem, self).__init__(id=id, attributes=attributes, tags=tags, x509_thumbprint=x509_thumbprint, **kwargs) + self.recovery_id = recovery_id + self.scheduled_purge_date = None + self.deleted_date = None + + +class DeletedCertificateListResult(msrest.serialization.Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: A response message containing a list of deleted certificates in the vault along + with a link to the next page of deleted certificates. + :vartype value: list[~azure.keyvault.v7_2.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + +class Error(msrest.serialization.Model): + """The key vault server error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The key vault server error. + :vartype inner_error: ~azure.keyvault.v7_2.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IssuerAttributes(msrest.serialization.Model): + """The attributes of an issuer managed by the Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the issuer is enabled. + :type enabled: bool + :ivar created: Creation time in UTC. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in UTC. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + **kwargs + ): + super(IssuerAttributes, self).__init__(**kwargs) + self.enabled = enabled + self.created = None + self.updated = None + + +class IssuerBundle(msrest.serialization.Model): + """The issuer for Key Vault certificate. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Identifier for the issuer object. + :vartype id: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'provider': {'key': 'provider', 'type': 'str'}, + 'credentials': {'key': 'credentials', 'type': 'IssuerCredentials'}, + 'organization_details': {'key': 'org_details', 'type': 'OrganizationDetails'}, + 'attributes': {'key': 'attributes', 'type': 'IssuerAttributes'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + credentials: Optional["IssuerCredentials"] = None, + organization_details: Optional["OrganizationDetails"] = None, + attributes: Optional["IssuerAttributes"] = None, + **kwargs + ): + super(IssuerBundle, self).__init__(**kwargs) + self.id = None + self.provider = provider + self.credentials = credentials + self.organization_details = organization_details + self.attributes = attributes + + +class IssuerCredentials(msrest.serialization.Model): + """The credentials to be used for the certificate issuer. + + :param account_id: The user name/account name/account id. + :type account_id: str + :param password: The password/secret/account key. + :type password: str + """ + + _attribute_map = { + 'account_id': {'key': 'account_id', 'type': 'str'}, + 'password': {'key': 'pwd', 'type': 'str'}, + } + + def __init__( + self, + *, + account_id: Optional[str] = None, + password: Optional[str] = None, + **kwargs + ): + super(IssuerCredentials, self).__init__(**kwargs) + self.account_id = account_id + self.password = password + + +class IssuerParameters(msrest.serialization.Model): + """Parameters for the issuer of the X509 component of a certificate. + + :param name: Name of the referenced issuer object or reserved names; for example, 'Self' or + 'Unknown'. + :type name: str + :param certificate_type: Certificate type as supported by the provider (optional); for example + 'OV-SSL', 'EV-SSL'. + :type certificate_type: str + :param certificate_transparency: Indicates if the certificates generated under this policy + should be published to certificate transparency logs. + :type certificate_transparency: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'certificate_type': {'key': 'cty', 'type': 'str'}, + 'certificate_transparency': {'key': 'cert_transparency', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + certificate_type: Optional[str] = None, + certificate_transparency: Optional[bool] = None, + **kwargs + ): + super(IssuerParameters, self).__init__(**kwargs) + self.name = name + self.certificate_type = certificate_type + self.certificate_transparency = certificate_transparency + + +class KeyProperties(msrest.serialization.Model): + """Properties of the key pair backing a certificate. + + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + :param key_type: The type of key pair to be used for the certificate. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM", "oct", "oct-HSM". + :type key_type: str or ~azure.keyvault.v7_2.models.JsonWebKeyType + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param reuse_key: Indicates if the same key pair will be used on certificate renewal. + :type reuse_key: bool + :param curve: Elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values + include: "P-256", "P-384", "P-521", "P-256K". + :type curve: str or ~azure.keyvault.v7_2.models.JsonWebKeyCurveName + """ + + _attribute_map = { + 'exportable': {'key': 'exportable', 'type': 'bool'}, + 'key_type': {'key': 'kty', 'type': 'str'}, + 'key_size': {'key': 'key_size', 'type': 'int'}, + 'reuse_key': {'key': 'reuse_key', 'type': 'bool'}, + 'curve': {'key': 'crv', 'type': 'str'}, + } + + def __init__( + self, + *, + exportable: Optional[bool] = None, + key_type: Optional[Union[str, "JsonWebKeyType"]] = None, + key_size: Optional[int] = None, + reuse_key: Optional[bool] = None, + curve: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.exportable = exportable + self.key_type = key_type + self.key_size = key_size + self.reuse_key = reuse_key + self.curve = curve + + +class KeyVaultError(msrest.serialization.Model): + """The key vault error exception. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The key vault server error. + :vartype error: ~azure.keyvault.v7_2.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultError, self).__init__(**kwargs) + self.error = None + + +class LifetimeAction(msrest.serialization.Model): + """Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. + + :param trigger: The condition that will execute the action. + :type trigger: ~azure.keyvault.v7_2.models.Trigger + :param action: The action that will be executed. + :type action: ~azure.keyvault.v7_2.models.Action + """ + + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, + } + + def __init__( + self, + *, + trigger: Optional["Trigger"] = None, + action: Optional["Action"] = None, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = trigger + self.action = action + + +class OrganizationDetails(msrest.serialization.Model): + """Details of the organization of the certificate issuer. + + :param id: Id of the organization. + :type id: str + :param admin_details: Details of the organization administrator. + :type admin_details: list[~azure.keyvault.v7_2.models.AdministratorDetails] + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'admin_details': {'key': 'admin_details', 'type': '[AdministratorDetails]'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + admin_details: Optional[List["AdministratorDetails"]] = None, + **kwargs + ): + super(OrganizationDetails, self).__init__(**kwargs) + self.id = id + self.admin_details = admin_details + + +class PendingCertificateSigningRequestResult(msrest.serialization.Model): + """The pending certificate signing request result. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The pending certificate signing request as Base64 encoded string. + :vartype value: str + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PendingCertificateSigningRequestResult, self).__init__(**kwargs) + self.value = None + + +class SecretProperties(msrest.serialization.Model): + """Properties of the key backing a certificate. + + :param content_type: The media type (MIME type). + :type content_type: str + """ + + _attribute_map = { + 'content_type': {'key': 'contentType', 'type': 'str'}, + } + + def __init__( + self, + *, + content_type: Optional[str] = None, + **kwargs + ): + super(SecretProperties, self).__init__(**kwargs) + self.content_type = content_type + + +class SubjectAlternativeNames(msrest.serialization.Model): + """The subject alternate names of a X509 object. + + :param emails: Email addresses. + :type emails: list[str] + :param dns_names: Domain names. + :type dns_names: list[str] + :param upns: User principal names. + :type upns: list[str] + """ + + _attribute_map = { + 'emails': {'key': 'emails', 'type': '[str]'}, + 'dns_names': {'key': 'dns_names', 'type': '[str]'}, + 'upns': {'key': 'upns', 'type': '[str]'}, + } + + def __init__( + self, + *, + emails: Optional[List[str]] = None, + dns_names: Optional[List[str]] = None, + upns: Optional[List[str]] = None, + **kwargs + ): + super(SubjectAlternativeNames, self).__init__(**kwargs) + self.emails = emails + self.dns_names = dns_names + self.upns = upns + + +class Trigger(msrest.serialization.Model): + """A condition to be satisfied for an action to be executed. + + :param lifetime_percentage: Percentage of lifetime at which to trigger. Value should be between + 1 and 99. + :type lifetime_percentage: int + :param days_before_expiry: Days before expiry to attempt renewal. Value should be between 1 and + validity_in_months multiplied by 27. If validity_in_months is 36, then value should be between + 1 and 972 (36 * 27). + :type days_before_expiry: int + """ + + _validation = { + 'lifetime_percentage': {'maximum': 99, 'minimum': 1}, + } + + _attribute_map = { + 'lifetime_percentage': {'key': 'lifetime_percentage', 'type': 'int'}, + 'days_before_expiry': {'key': 'days_before_expiry', 'type': 'int'}, + } + + def __init__( + self, + *, + lifetime_percentage: Optional[int] = None, + days_before_expiry: Optional[int] = None, + **kwargs + ): + super(Trigger, self).__init__(**kwargs) + self.lifetime_percentage = lifetime_percentage + self.days_before_expiry = days_before_expiry + + +class X509CertificateProperties(msrest.serialization.Model): + """Properties of the X509 component of a certificate. + + :param subject: The subject name. Should be a valid X509 distinguished Name. + :type subject: str + :param ekus: The enhanced key usage. + :type ekus: list[str] + :param subject_alternative_names: The subject alternative names. + :type subject_alternative_names: ~azure.keyvault.v7_2.models.SubjectAlternativeNames + :param key_usage: List of key usages. + :type key_usage: list[str or ~azure.keyvault.v7_2.models.KeyUsageType] + :param validity_in_months: The duration that the certificate is valid in months. + :type validity_in_months: int + """ + + _validation = { + 'validity_in_months': {'minimum': 0}, + } + + _attribute_map = { + 'subject': {'key': 'subject', 'type': 'str'}, + 'ekus': {'key': 'ekus', 'type': '[str]'}, + 'subject_alternative_names': {'key': 'sans', 'type': 'SubjectAlternativeNames'}, + 'key_usage': {'key': 'key_usage', 'type': '[str]'}, + 'validity_in_months': {'key': 'validity_months', 'type': 'int'}, + } + + def __init__( + self, + *, + subject: Optional[str] = None, + ekus: Optional[List[str]] = None, + subject_alternative_names: Optional["SubjectAlternativeNames"] = None, + key_usage: Optional[List[Union[str, "KeyUsageType"]]] = None, + validity_in_months: Optional[int] = None, + **kwargs + ): + super(X509CertificateProperties, self).__init__(**kwargs) + self.subject = subject + self.ekus = ekus + self.subject_alternative_names = subject_alternative_names + self.key_usage = key_usage + self.validity_in_months = validity_in_months diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/version.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/__init__.py similarity index 70% rename from sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/version.py rename to sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/__init__.py index d92d6366736..44bfc9d07bb 100644 --- a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_1_preview/version.py +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/__init__.py @@ -1,13 +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. # -------------------------------------------------------------------------- -VERSION = "7.1-preview" +from ._key_vault_client_operations import KeyVaultClientOperationsMixin +__all__ = [ + 'KeyVaultClientOperationsMixin', +] diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/_key_vault_client_operations.py new file mode 100644 index 00000000000..a6f68a9aacd --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/operations/_key_vault_client_operations.py @@ -0,0 +1,1886 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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 .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class KeyVaultClientOperationsMixin(object): + + def get_certificates( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] + """List certificates in a specified key vault. + + The GetCertificates operation returns the set of certificates resources in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + if include_pending is not None: + query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_certificates.metadata = {'url': '/certificates'} # type: ignore + + def delete_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" + """Deletes a certificate from a specified key vault. + + Deletes all versions of a certificate object along with its associated policy. Delete + certificate cannot be used to remove individual versions of a certificate object. This + operation requires the certificates/delete permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate.metadata = {'url': '/certificates/{certificate-name}'} # type: ignore + + def set_certificate_contacts( + self, + vault_base_url, # type: str + contact_list=None, # type: Optional[List["models.Contact"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" + """Sets the certificate contacts for the specified key vault. + + Sets the certificate contacts for the specified key vault. This operation requires the + certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param contact_list: The contact list for the vault certificates. + :type contact_list: list[~azure.keyvault.v7_2.models.Contact] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _contacts = models.Contacts(contact_list=contact_list) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.set_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_contacts, 'Contacts') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + set_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" + """Lists the certificate contacts for a specified key vault. + + The GetCertificateContacts operation returns the set of certificate contact resources in the + specified key vault. This operation requires the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def delete_certificate_contacts( + self, + vault_base_url, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.Contacts" + """Deletes the certificate contacts for a specified key vault. + + Deletes the certificate contacts for a specified key vault certificate. This operation requires + the certificates/managecontacts permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Contacts, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.Contacts + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Contacts"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_contacts.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('Contacts', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_contacts.metadata = {'url': '/certificates/contacts'} # type: ignore + + def get_certificate_issuers( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateIssuerListResult"] + """List certificate issuers for a specified key vault. + + The GetCertificateIssuers operation returns the set of certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateIssuerListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateIssuerListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateIssuerListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificate_issuers.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateIssuerListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_certificate_issuers.metadata = {'url': '/certificates/issuers'} # type: ignore + + def set_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider, # type: str + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" + """Sets the specified certificate issuer. + + The SetCertificateIssuer operation adds or updates the specified certificate issuer. This + operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerSetParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.set_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerSetParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + set_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def update_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + provider=None, # type: Optional[str] + credentials=None, # type: Optional["models.IssuerCredentials"] + organization_details=None, # type: Optional["models.OrganizationDetails"] + attributes=None, # type: Optional["models.IssuerAttributes"] + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" + """Updates the specified certificate issuer. + + The UpdateCertificateIssuer operation performs an update on the specified certificate issuer + entity. This operation requires the certificates/setissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :param provider: The issuer provider. + :type provider: str + :param credentials: The credentials to be used for the issuer. + :type credentials: ~azure.keyvault.v7_2.models.IssuerCredentials + :param organization_details: Details of the organization as provided to the issuer. + :type organization_details: ~azure.keyvault.v7_2.models.OrganizationDetails + :param attributes: Attributes of the issuer object. + :type attributes: ~azure.keyvault.v7_2.models.IssuerAttributes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameter = models.CertificateIssuerUpdateParameters(provider=provider, credentials=credentials, organization_details=organization_details, attributes=attributes) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameter, 'CertificateIssuerUpdateParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def get_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" + """Lists the specified certificate issuer. + + The GetCertificateIssuer operation returns the specified certificate issuer resources in the + specified key vault. This operation requires the certificates/manageissuers/getissuers + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def delete_certificate_issuer( + self, + vault_base_url, # type: str + issuer_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.IssuerBundle" + """Deletes the specified certificate issuer. + + The DeleteCertificateIssuer operation permanently removes the specified certificate issuer from + the vault. This operation requires the certificates/manageissuers/deleteissuers permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param issuer_name: The name of the issuer. + :type issuer_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: IssuerBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.IssuerBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.IssuerBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_issuer.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'issuer-name': self._serialize.url("issuer_name", issuer_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' + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('IssuerBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_issuer.metadata = {'url': '/certificates/issuers/{issuer-name}'} # type: ignore + + def create_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" + """Creates a new certificate. + + If this is the first version, the certificate resource is created. This operation requires the + certificates/create permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateCreateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateCreateParameters') + 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 [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_certificate.metadata = {'url': '/certificates/{certificate-name}/create'} # type: ignore + + def import_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + base64_encoded_certificate, # type: str + password=None, # type: Optional[str] + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Imports a certificate into a specified key vault. + + 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. If the certificate is in PEM + format the PEM file must contain the key as well as x509 certificates. This operation requires + the certificates/import permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param base64_encoded_certificate: Base64 encoded representation of the certificate object to + import. This certificate needs to contain the private key. + :type base64_encoded_certificate: str + :param password: If the private key in base64EncodedCertificate is encrypted, the password used + for encryption. + :type password: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateImportParameters(base64_encoded_certificate=base64_encoded_certificate, password=password, certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.import_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str', pattern=r'^[0-9a-zA-Z-]+$'), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateImportParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + import_certificate.metadata = {'url': '/certificates/{certificate-name}/import'} # type: ignore + + def get_certificate_versions( + self, + vault_base_url, # type: str + certificate_name, # type: str + maxresults=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.CertificateListResult"] + """List the versions of a certificate. + + The GetCertificateVersions operation returns the versions of a certificate in the specified key + vault. This operation requires the certificates/list permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.CertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_certificate_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('CertificateListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} # type: ignore + + def get_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" + """Lists the policy for a certificate. + + The GetCertificatePolicy operation returns the specified certificate policy resources in the + specified key vault. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in a given key vault. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificatePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate_policy( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_policy, # type: "models.CertificatePolicy" + **kwargs # type: Any + ): + # type: (...) -> "models.CertificatePolicy" + """Updates the policy for a certificate. + + Set specified members in the certificate policy. Leave others as null. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_policy: The policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificatePolicy, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificatePolicy + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificatePolicy"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificatePolicy', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_policy.metadata = {'url': '/certificates/{certificate-name}/policy'} # type: ignore + + def update_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + certificate_policy=None, # type: Optional["models.CertificatePolicy"] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Updates the specified attributes associated with the given certificate. + + The UpdateCertificate operation applies the specified update on the given certificate; the only + elements updated are the certificate's attributes. This operation requires the + certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given key vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. + :type certificate_version: str + :param certificate_policy: The management policy for the certificate. + :type certificate_policy: ~azure.keyvault.v7_2.models.CertificatePolicy + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateUpdateParameters(certificate_policy=certificate_policy, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateUpdateParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def get_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + certificate_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Gets information about a certificate. + + Gets information about a specific certificate. This operation requires the certificates/get + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate in the given vault. + :type certificate_name: str + :param certificate_version: The version of the certificate. This URI fragment is optional. If + not specified, the latest version of the certificate is returned. + :type certificate_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str'), + 'certificate-version': self._serialize.url("certificate_version", certificate_version, '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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate.metadata = {'url': '/certificates/{certificate-name}/{certificate-version}'} # type: ignore + + def update_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + cancellation_requested, # type: bool + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" + """Updates a certificate operation. + + Updates a certificate creation operation that is already in progress. This operation requires + the certificates/update permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param cancellation_requested: Indicates if cancellation was requested on the certificate + operation. + :type cancellation_requested: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _certificate_operation = models.CertificateOperationUpdateParameter(cancellation_requested=cancellation_requested) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_certificate_operation, 'CertificateOperationUpdateParameter') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def get_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" + """Gets the creation operation of a certificate. + + Gets the creation operation associated with a specified certificate. This operation requires + the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def delete_certificate_operation( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateOperation" + """Deletes the creation operation for a specific certificate. + + Deletes the creation operation for a specified certificate that is in the process of being + created. The certificate is no longer created. This operation requires the certificates/update + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateOperation, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateOperation + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateOperation"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.delete_certificate_operation.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateOperation', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + delete_certificate_operation.metadata = {'url': '/certificates/{certificate-name}/pending'} # type: ignore + + def merge_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + x509_certificates, # type: List[bytearray] + certificate_attributes=None, # type: Optional["models.CertificateAttributes"] + tags=None, # type: Optional[Dict[str, str]] + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Merges a certificate or a certificate chain with a key pair existing on the server. + + The MergeCertificate operation performs the merging of a certificate or certificate chain with + a key pair currently available in the service. This operation requires the certificates/create + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :param x509_certificates: The certificate or the certificate chain to merge. + :type x509_certificates: list[bytearray] + :param certificate_attributes: The attributes of the certificate (optional). + :type certificate_attributes: ~azure.keyvault.v7_2.models.CertificateAttributes + :param tags: Application specific metadata in the form of key-value pairs. + :type tags: dict[str, str] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateMergeParameters(x509_certificates=x509_certificates, certificate_attributes=certificate_attributes, tags=tags) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.merge_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateMergeParameters') + 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 [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + merge_certificate.metadata = {'url': '/certificates/{certificate-name}/pending/merge'} # type: ignore + + def backup_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.BackupCertificateResult" + """Backs up the specified certificate. + + Requests that a backup of the specified certificate be downloaded to the client. All versions + of the certificate will be downloaded. This operation requires the certificates/backup + permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: BackupCertificateResult, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.BackupCertificateResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.BackupCertificateResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.backup_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('BackupCertificateResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + backup_certificate.metadata = {'url': '/certificates/{certificate-name}/backup'} # type: ignore + + def restore_certificate( + self, + vault_base_url, # type: str + certificate_bundle_backup, # type: bytes + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Restores a backed up certificate to a vault. + + Restores a backed up certificate, and all its versions, to a vault. This operation requires the + certificates/restore permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_bundle_backup: The backup blob associated with a certificate bundle. + :type certificate_bundle_backup: bytes + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + + _parameters = models.CertificateRestoreParameters(certificate_bundle_backup=certificate_bundle_backup) + api_version = "7.2-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.restore_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + 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' + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(_parameters, 'CertificateRestoreParameters') + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + restore_certificate.metadata = {'url': '/certificates/restore'} # type: ignore + + def get_deleted_certificates( + self, + vault_base_url, # type: str + maxresults=None, # type: Optional[int] + include_pending=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> Iterable["models.DeletedCertificateListResult"] + """Lists the deleted certificates in the specified vault currently available for recovery. + + The GetDeletedCertificates operation retrieves the certificates in the current vault which are + in a deleted state and ready for recovery or purging. This operation includes deletion-specific + information. This operation requires the certificates/get/list permission. This operation can + only be enabled on soft-delete enabled vaults. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param maxresults: Maximum number of results to return in a page. If not specified the service + will return up to 25 results. + :type maxresults: int + :param include_pending: Specifies whether to include certificates which are not completely + provisioned. + :type include_pending: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedCertificateListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.keyvault.v7_2.models.DeletedCertificateListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateListResult"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + if not next_link: + # Construct URL + url = self.get_deleted_certificates.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if maxresults is not None: + query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) + if include_pending is not None: + query_parameters['includePending'] = self._serialize.query("include_pending", include_pending, 'bool') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + } + url = self._client.format_url(url, **path_format_arguments) + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedCertificateListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(models.KeyVaultError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + get_deleted_certificates.metadata = {'url': '/deletedcertificates'} # type: ignore + + def get_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DeletedCertificateBundle" + """Retrieves information about the specified deleted certificate. + + The GetDeletedCertificate operation retrieves the deleted certificate information plus its + attributes, such as retention interval, scheduled permanent deletion and the current deletion + recovery level. This operation requires the certificates/get permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedCertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.DeletedCertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedCertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.get_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('DeletedCertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def purge_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Permanently deletes the specified deleted certificate. + + The PurgeDeletedCertificate operation performs an irreversible deletion of the specified + certificate, without possibility for recovery. The operation is not available if the recovery + level does not specify 'Purgeable'. This operation requires the certificate/purge permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the certificate. + :type certificate_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 = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.purge_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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] + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + if cls: + return cls(pipeline_response, None, {}) + + purge_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}'} # type: ignore + + def recover_deleted_certificate( + self, + vault_base_url, # type: str + certificate_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CertificateBundle" + """Recovers the deleted certificate back to its current version under /certificates. + + The RecoverDeletedCertificate 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 (available in the deleted certificate's attributes). This operation requires + the certificates/recover permission. + + :param vault_base_url: The vault name, for example https://myvault.vault.azure.net. + :type vault_base_url: str + :param certificate_name: The name of the deleted certificate. + :type certificate_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CertificateBundle, or the result of cls(response) + :rtype: ~azure.keyvault.v7_2.models.CertificateBundle + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CertificateBundle"] + error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} + error_map.update(kwargs.pop('error_map', {})) + api_version = "7.2-preview" + + # Construct URL + url = self.recover_deleted_certificate.metadata['url'] # type: ignore + path_format_arguments = { + 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True), + 'certificate-name': self._serialize.url("certificate_name", certificate_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' + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(models.KeyVaultError, response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('CertificateBundle', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + recover_deleted_certificate.metadata = {'url': '/deletedcertificates/{certificate-name}/recover'} # type: ignore diff --git a/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/py.typed b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_generated/v7_2_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file